Advertisement
Guest User

menu

a guest
Apr 30th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. m = peripheral.wrap("left")
  2. m.clear()
  3.  
  4. m.setCursorPos(2,1)
  5. m.setTextColor(512)
  6. m.write("Bienvenu dans mon Menu V1.0")
  7. m.setCursorPos(9,2)
  8. m.write("De:RubikCuber")
  9.  
  10. m.setCursorPos(1,3)
  11. m.setTextColor(2)
  12. m.write("Liste des Programes:")
  13.  
  14. mouseWidth = 0
  15. mouseHeight = 0
  16.  
  17. m.setCursorPos(1,4)
  18.  
  19. w,h=m.getSize()
  20.  
  21. print(w)
  22. print(h)
  23.  
  24. m.setTextColor(8192)
  25.  
  26. m.setCursorPos(1,4)
  27.  
  28. m.write("CADlumiere")
  29.  
  30. m.setCursorPos(12,4)
  31.  
  32. m.write("ShutDown")
  33.  
  34. function checkClickPosition()
  35.   if mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
  36.     shell.run("CADlumiere")
  37.   elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
  38.     os.shutdown()
  39.   end
  40. end
  41.  
  42. repeat
  43.  
  44.   event,p1,p2,p3 = os.pullEvent()
  45.  
  46.     if event=="monitor_touch" then
  47.      
  48.       mouseWidth = p2
  49.       mouseHeight = p3
  50.       checkClickPosition()
  51.      
  52.     end
  53.    
  54. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement