Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- TouchAPI-Beispiel zur Funktionalität
- -- Beispielprogramm von SomethingSpecialLP aka comfix
- ------ Defines
- monSide = "top" -- Monitorseite
- ButtonText_Open = "AUF" -- Buttonbeschriftung - Auf
- ButtonText_Close = "Z U" -- Buttonbeschriftung - Zu
- ------ Functions
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function bp(TEXT,METHOD,X,Y,CO,BACO)-- BetterPrint "Monitor" -- Zur freien Verwendung / Kann über API eingebungen werden
- if X ~= nil and Y ~= nil then
- mon.setCursorPos(X,Y)
- end
- if CO ~= nil then
- mon.setTextColor(CO)
- end
- if BACO ~= nil then
- mon.setBackgroundColor(BACO)
- end
- if TEXT ~= nil and METHOD ~= nil then
- if METHOD == "w" then
- mon.write(TEXT)
- end
- else
- --print("In BetterPrint muss 'TEXT' und 'METHOD' gesetzt sein!")
- --term.setCursorPos(0,0)
- print("Error: "..tostring(TEXT))
- error()
- end
- TEXT,METHOD,X,Y,CO,BACO = nil
- end
- function writeButtons()
- clear()
- bp(" "..ButtonText_Open.." ","w",1,1,1,32)
- bp(" "..ButtonText_Close.." ","w",1,2,1,16384)
- end
- ------ Main Loop
- mon = peripheral.wrap(monSide)
- writeButtons()
- while true do
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- for _X=0,5 do
- if _X == xPos and _Y == 1 then
- -- Function OPEN
- end
- if _X == xPos and _Y == 2 then
- -- Function CLOSE
- end
- end
- end
- -- -- -- Farben Codes -- -- colors. -- --
- -- 1 - Weiss -white
- -- 2 - Orange -orange
- -- 4 - Magenta -magenta
- -- 8 - Hellblau -lightBlue
- -- 16 - Gelb -yellow
- -- 32 - Hellgrün -lime
- -- 64 - Rosa -pink
- -- 128 - Grau -grey
- -- 256 - Hellgrau -lightGrey
- -- 512 - Türkis -cyan
- -- 1024 - Violett -purple
- -- 2048 - Blau -blue
- -- 4069 - Braun -brown
- -- 8192 - Grün -green
- -- 16384 - Rot -red
- -- 32768 - Schwarz -black
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement