Advertisement
PRIMETOXINZ

ButtonApi

Nov 30th, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. button[name]["active"] = not button[name]["active"]
  2. if button[name]["color"] == Green then
  3. button[name]["color"] = Red
  4. else
  5. button[name]["color"]=Green
  6. end
  7. end
  8.  
  9. function API.checkxy(x, y)
  10. for name, data in pairs(button) do
  11. if y>=data["ymin"] and y <= data["ymax"] then
  12. if x>=data["xmin"] and x<= data["xmax"] then
  13. if data["passName"] then
  14. data["func"](name)
  15. else
  16. data["func"]()
  17. end
  18. return true
  19. end
  20. end
  21. end
  22. return false
  23. end
  24.  
  25. function API.heading(text)
  26. w, h = mon.getResolution()
  27. term.setCursor((w-string.len(text))/2+1, 1)
  28. term.write(text)
  29. end
  30.  
  31. function API.label(w, h, text)
  32. term.setCursor(w, h)
  33. term.write(text)
  34. end
  35.  
  36. return API
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement