Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local tape = component.tape_drive
- local gpu = component.gpu
- local un = require("unicode")
- local computer = require("computer")
- local click = require("event").pull
- local width = 50
- local height = 100 / 2
- local Buttons = {
- {
- x = 2, y = 2,
- txt = '▶',
- clr = 0xff00ff,
- action = function() tape.play(); end
- }
- }
- function drawButton(n)
- --gpu.setBackground(Buttons[n].fgclr)
- gpu.setForeground(Buttons[n].clr)
- gpu.fill(Buttons[n].x, Buttons[n].y,1,1, ' ')
- gpu.set(Buttons[n].x+1-(un.len(Buttons[n].txt)/2), Buttons[n].y+1, Buttons[n].txt)
- end
- while true do
- gpu.setBackground(0xffffff)
- gpu.fill(1, 1, width, height, ' ')
- drawButton(i)
- local event = {click('touch')}
- for i = 1, #Buttons do
- if event[3] == Buttons[i].x and event[4] == Buttons[i].y then
- drawButton(i)
- Buttons[i].action()
- end
- end
- end
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement