Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gpu = require("component").gpu
- local ev = require("event")
- function context(x,y,w,tables)
- -- коробка
- for i=1,#tables do
- if tables[i][1] ~= "---" then
- if tables[i][3] ~= false then
- gpu.setForeground(0x000000)
- gpu.setBackground(tables[i][4] or 0xFFFFFF)
- gpu.fill(x,y+i-1,w,1," ")
- gpu.set(x,y+i-1,tables[i][1])
- elseif not tables[i][3] then
- gpu.setForeground(0xDDDDDD)
- gpu.fill(x,y+i-1,w,1," ")
- gpu.set(x,y+i-1,tables[i][1])
- end
- else
- gpu.setForeground(0x000000)
- gpu.setBackground(0xFFFFFF)
- gpu.fill(x,y+i-1,w,1,"-")
- end
- end
- -- тень
- gpu.setBackground(0xCCCCCC)
- gpu.fill(x+w,y+1,1,#tables," ")
- gpu.fill(x+1,y+#tables,w,1," ")
- -- клик
- name,addr,xp,yp,btt,name = ev.pull("touch")
- if xp >= x and yp >= y and xp < x + w and yp < y + #tables then
- for i=1,#tables do
- if yp == x + i - 1 and tables[i][1] ~= "---" and tables[i][3] then
- tables[i][2]()
- end
- end
- else
- return false
- end
- end
- ---------------------------------------------
- -- U S I N G
- local t = {
- {"Cut",load("require([[component]]).gpu.setForeground(0x000000) print([[хахаха]])"),true},
- {"Copy",load("require([[component]]).gpu.setForeground(0x000000) print([[хахаха]])"),true},
- {"Paste",load("require([[component]]).gpu.setForeground(0x000000) print([[хахаха]])"),true},
- {"---"},
- {"Give Dimonds",load(""),false},
- {"Give -*",load(""),false},
- }
- context(5,5,15,t)
Advertisement
Add Comment
Please, Sign In to add comment