Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local unicode = require("unicode")
  2.  
  3. function drawButton(x,y,bg,fg,text)
  4. local oldbg = gpu.getBackground()
  5. local oldfg = gpu.getForeground()
  6. gpu.setBackground(bg)
  7. gpu.setForeground(fg)
  8. gpu.set(x,y,text)
  9. gpu.setBackground(oldbg)
  10. gpu.setForeground(oldfg)
  11. end
  12.  
  13. drawButton(2,2,0xff0000, 0x00ff00, "PressMeToWin")
  14.  
  15. while true do
  16. local name, add, xP, yP, b = event.pull("touch")
  17. if name ~= nil then
  18. if xP >= 2 and yP == 2 and xP <= 2 + unicode.len("PressMeToWin") then
  19. gpu.set(1,20, "Ok!")
  20. os.sleep(2)
  21. gpu.fill(1,20,10,10, " ")
  22. end
  23. end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement