IncludeUrl

Untitled

Jun 30th, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. local gpu = require("component").gpu
  2. local ev = require("event")
  3. function context(x,y,w,tables)
  4. -- коробка
  5. for i=1,#tables do
  6. if tables[i][1] ~= "---" then
  7. if tables[i][3] ~= false then
  8. gpu.setForeground(0x000000)
  9. gpu.setBackground(tables[i][4] or 0xFFFFFF)
  10. gpu.fill(x,y+i-1,w,1," ")
  11. gpu.set(x,y+i-1,tables[i][1])
  12. elseif not tables[i][3] then
  13. gpu.setForeground(0xDDDDDD)
  14. gpu.fill(x,y+i-1,w,1," ")
  15. gpu.set(x,y+i-1,tables[i][1])
  16. end
  17. else
  18. gpu.setForeground(0x000000)
  19. gpu.setBackground(0xFFFFFF)
  20. gpu.fill(x,y+i-1,w,1,"-")
  21. end
  22. end
  23.  
  24. -- тень
  25. gpu.setBackground(0xCCCCCC)
  26. gpu.fill(x+w,y+1,1,#tables," ")
  27. gpu.fill(x+1,y+#tables,w,1," ")
  28.  
  29. -- клик
  30. name,addr,xp,yp,btt,name = ev.pull("touch")
  31. if xp >= x and yp >= y and xp < x + w and yp < y + #tables then
  32. for i=1,#tables do
  33. if yp == x + i - 1 and tables[i][1] ~= "---" and tables[i][3] then
  34. tables[i][2]()
  35. end
  36. end
  37. else
  38. return false
  39. end
  40. end
  41.  
  42. ---------------------------------------------
  43. -- U S I N G
  44.  
  45. local t = {
  46. {"Cut",load("require([[component]]).gpu.setForeground(0x000000) print([[хахаха]])"),true},
  47. {"Copy",load("require([[component]]).gpu.setForeground(0x000000) print([[хахаха]])"),true},
  48. {"Paste",load("require([[component]]).gpu.setForeground(0x000000) print([[хахаха]])"),true},
  49. {"---"},
  50. {"Give Dimonds",load(""),false},
  51. {"Give -*",load(""),false},
  52. }
  53. context(5,5,15,t)
Advertisement
Add Comment
Please, Sign In to add comment