Advertisement
Guest User

gui.lua

a guest
Nov 17th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. local program1 = "   Tür   "
  2. local program2 = "   AKW   "
  3. local blank =    "         "
  4. local ext =      "<>"
  5. local function drawGui()
  6.     image = paintutils.loadImage("backwall.nfp")    
  7.     paintutils.drawImage(image, 1, 1)
  8.     term.setBackgroundColor(colors.white)
  9.     term.setTextColor(colors.black)
  10.    
  11.     term.setCursorPos(3, 2)
  12.     write(blank)
  13.     term.setCursorPos(3, 3)
  14.     write(program1)
  15.     term.setCursorPos(3, 4)
  16.     write(blank)
  17.     term.setCursorPos(16, 2)
  18.     write(blank)
  19.     term.setCursorPos(16, 3)
  20.     write(program2)
  21.     term.setCursorPos(16, 4)
  22.     write(blank)
  23.     term.setCursorPos(25,20)
  24.     write(ext)
  25. end
  26.  
  27. drawGui()
  28.  
  29. while true do
  30.     local event, button, cx, cy = os.pullEvent()
  31.    
  32.     if event == "mouse_click" then
  33.         if (cx >= 3 and cx <= 3+program1:len()) and (cy == 2 or cy == 3 or cy == 4) and button == 1 then
  34.             shell.run("gui_tuer.lua")
  35.         elseif (cx >= 16 and cx <= 16+program2:len()) and (cy == 2 or cy == 3 or cy == 4) and button == 1 then
  36.             shell.run("gui_akw.lua")
  37.         elseif (cx >= 25 and cx <= 25+ext:len()) and cy == 20 and button == 1 then
  38.             os.reboot()
  39.         end
  40.     end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement