Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- local vesion = 0.01
- local running = true
- --Booleans
- _ms = 0
- --Functions
- --Clears the screen
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- --Stops the program
- function stop()
- term.setBackgroundColor(colors.black)
- clear()
- running = false
- sleep(0.1)
- print"Closed GUI"
- end
- --Draws the window
- function drawWindow()
- term.setBackgroundColor(colors.white)
- clear()
- term.setBackgroundColor(colors.blue)
- term.clearLine()
- term.setCursorPos(51,1)
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- print"X"
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- term.setCursorPos(2,3)
- print" Hello "
- end
- --The runtime is the engine of the GUI. While this is running the GUI works
- function runtime()
- while running do
- event, button, x, y = os.pullEventRaw("mouse_click")
- if _ms == 0 and button == 1 and x == 51 and y == 1 then
- stop()
- elseif _ms == 0 and button == 1 and x >=2 and x < 9 and y == 3 then
- stop()
- print"Hello"
- end
- end
- end
- --Initializes the GUI
- function init()
- _ms = 0
- drawWindow()
- runtime()
- end
- --Main Code
- init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement