Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calc_color(textcolor)
- return math.pow(2, textcolor - 1)
- end
- function m(gap, line, textcolor, background, text)
- mon.setBackgroundColor(calc_color(background))
- mon.setCursorPos(gap,line)
- mon.setTextColor(calc_color(textcolor))
- text = mon.write(text)
- end
- function t(gap, line, textcolor, background, text)
- term.setBackgroundColor(calc_color(background))
- term.setCursorPos(gap,line)
- term.setTextColor(calc_color(textcolor))
- text = term.write(text)
- end
- --term("1,1,"Monitor Seite")
- --side = read()
- side = "right"
- mon = peripheral.wrap(side)
- mon.setTextScale(1)
- term.clear()
- t(01,01,06,16,"Schriftgrösse wählen, drück auf den Button um ")
- t(01,02,06,16,"auf dem Monitor ein Beispiel zu sehen.")
- function DrawTextScaleButtons()
- a = 1
- for c = 3,31,7 do
- t(c,04,01,15," "..a.." ")
- a = a + 1
- end
- a = 1.5
- for c = 3,24,7 do
- t(c,06,01,15," "..a.." ")
- a = a + 1
- end
- t(03,08,01,15," bestätigen ")
- monsize()
- TextScale()
- end
- function monsize()
- mon.setTextColor(1)
- b = 1
- for a = 1,99 do
- mon.setCursorPos(1,a)
- if b == 10 then
- mon.setCursorPos(1,b)
- b = 1
- else
- mon.write(b.." ")
- b = b + 1
- end
- end
- b = 1
- for a = 1,99 do
- mon.setCursorPos(a,1)
- if b == 10 then
- b = 1
- else
- mon.write(b)
- b = b + 1
- end
- end
- end
- function TextScale()
- local event, button, X, Y = os.pullEvent("mouse_click")
- if X >= 03 and X <= 07 and Y == 4 and side == side then -- 1
- mon.setTextScale(1)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 10 and X <= 14 and Y == 4 and side == side then -- 2
- mon.setTextScale(2)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 17 and X <= 21 and Y == 4 and side == side then -- 3
- mon.setTextScale(3)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 24 and X <= 28 and Y == 4 and side == side then -- 4
- mon.setTextScale(4)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 31 and X <= 35 and Y == 4 and side == side then -- 5
- mon.setTextScale(5)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 03 and X <= 07 and Y == 6 and side == side then -- 1.5
- mon.setTextScale(1.5)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 10 and X <= 14 and Y == 6 and side == side then -- 2.5
- mon.setTextScale(2.5)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 17 and X <= 21 and Y == 6 and side == side then -- 3.5
- mon.setTextScale(3.5)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 24 and X <= 28 and Y == 6 and side == side then -- 4.5
- mon.setTextScale(4.5)
- monsize()
- m(02,02,06,16,"Beispieltext")
- TextScale()
- elseif X >= 03 and X <= 14 and Y == 8 and side == side then -- bestätigen
- term.clear()
- else
- TextScale()
- sleep(0.5)
- end
- end
- DrawTextScaleButtons()
Add Comment
Please, Sign In to add comment