Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local serialization = require("serialization")
- local event = require("event")
- local os = require("os")
- local thread = require("thread")
- local unicode = require("unicode")
- local gpu = component.gpu
- local modem = component.modem
- local black = 0x000000
- local white = 0xFFFFFF
- local gray = 0x212121
- local blue = 0x0000FF
- local gui1 = thread.create(function()
- local x = 10
- local y = 5
- local w = 40
- local h = 15
- local title = "test"
- while true do
- gpu.setBackground(gray)
- gpu.setForeground(white)
- gpu.fill(x, y, w, h, " ")
- gpu.set(x, y, unicode.char(0x2554))
- gpu.set(x+w-1, y, unicode.char(0x2557))
- gpu.set(x, y+h-1, unicode.char(0x255A))
- gpu.set(x+w-1, y+h-1, unicode.char(0x255D))
- gpu.fill(x+1, y, w-2, 1, unicode.char(0x2550))
- gpu.fill(x+1, y+h-1, w-2, 1, unicode.char(0x2550))
- gpu.fill(x, y+1, 1, h-2, unicode.char(0x2551))
- gpu.fill(x+w-1, y+1, 1, h-2, unicode.char(0x2551))
- local t = unicode.char(0x2561) .. title .. unicode.char(0x255e)
- gpu.set(x+(w/2) - (string.len(t)/2), y, t)
- gpu.setBackground(blue)
- gpu.setForeground(white)
- gpu.set(x+(w/2)-4, y+h-2, "[close]")
- -- closeButton[0] = x+(w/2)-4
- -- closeButton[1] = y+h-2
- local id1, _, x1, y1, b1 = event.pull("touch")
- if id1 ~= nil then
- gpu.setBackground(blue)
- gpu.setForeground(white)
- gpu.set(1, 1, "1 : " .. x1 .. " " .. y1 .. " " .. b1)
- end
- end
- end)
- local gui2 = thread.create(function()
- local x = 30
- local y = 15
- local w = 30
- local h = 10
- local title = "test2"
- while true do
- gpu.setBackground(gray)
- gpu.setForeground(white)
- gpu.fill(x, y, w, h, " ")
- gpu.set(x, y, unicode.char(0x2554))
- gpu.set(x+w-1, y, unicode.char(0x2557))
- gpu.set(x, y+h-1, unicode.char(0x255A))
- gpu.set(x+w-1, y+h-1, unicode.char(0x255D))
- gpu.fill(x+1, y, w-2, 1, unicode.char(0x2550))
- gpu.fill(x+1, y+h-1, w-2, 1, unicode.char(0x2550))
- gpu.fill(x, y+1, 1, h-2, unicode.char(0x2551))
- gpu.fill(x+w-1, y+1, 1, h-2, unicode.char(0x2551))
- local t = unicode.char(0x2561) .. title .. unicode.char(0x255e)
- gpu.set(x+(w/2) - (string.len(t)/2), y, t)
- gpu.setBackground(blue)
- gpu.setForeground(white)
- gpu.set(x+(w/2)-4, y+h-2, "[close]")
- -- closeButton[0] = x+(w/2)-4
- -- closeButton[1] = y+h-2
- local id1, _, x1, y1, b1 = event.pull("touch")
- if id1 ~= nil then
- gpu.setBackground(blue)
- gpu.setForeground(white)
- gpu.set(1, 2, "2 : " .. x1 .. " " .. y1 .. " " .. b1)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement