Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gg = require("gpgui")
- --local gp = require("gpic")
- local gpu = require("component").gpu
- local bgold,fgold = gpu.getBackground(),gpu.getForeground()
- local w,h = gpu.getResolution()
- require("term").clear()
- gpu.fill(1,h-3,w,1,"━")
- local form = gg.newForm()
- local tbg = gg.newTextbox()
- tbg:setSize(6,3)
- tbg:setPos(1,h-2)
- local tfg = gg.newTextbox()
- tfg:setSize(6,3)
- tfg:setPos(8,h-2)
- local resetColors = gg.newButton()
- resetColors:setPos(16,h-2)
- resetColors:setSize(9,3)
- resetColors:setValue("СБРОС")
- resetColors:setFunc(function()
- gpu.setBackground(bgold)
- gpu.setForeground(fgold)
- end)
- local symb
- local own = gg.newOwn()
- own:addListener("drag")
- own:addListener("touch")
- own:setFunc(function(type,_,x,y,button,_)
- if type == "drag" or type == "touch" then
- if y < h-3 then
- if button == 0 then
- if tbg:getValue() ~= "" then
- gpu.setBackground(tonumber("0x"..tbg:getValue()));
- end
- if tfg:getValue() ~= "" then
- gpu.setForeground(tonumber("0x"..tfg:getValue()));
- end
- gpu.set(x,y,symb);
- elseif button == 1 then
- gpu.setBackground(bgold)
- gpu.setForeground(fgold)
- gpu.set(x,y," ");
- end
- end
- end
- end)
- local buttons = {}
- local chars = {"▓","▒","░","X","┏","┓","━","┗","┛","┃","┣","┫","┳","┻","╋"}
- for i=1,#chars do
- buttons["b"..i] = gg.newButton()
- buttons["b"..i]:setPos(30+i*2,h-1)
- buttons["b"..i]:setValue(chars[i])
- buttons["b"..i]:setSize(1,1)
- buttons["b"..i]:setFunc(function() symb = chars[i] end)
- form:add(buttons["b"..i])
- end
- local exit = gg.newButton()
- exit:setPos(w-5,h-2)
- exit:setSize(5,3)
- exit:setValue("ВЫЙТИ")
- exit:setFunc(function()
- form:ignore()
- own:ignore()
- gpu.setBackground(bgold)
- gpu.setForeground(fgold)
- require("term").clear()
- os.exit()
- end)
- --[[local save = gg.newButton()
- save:setPos(w-12,h-2)
- save:setSize(4,3)
- save:setValue("SAVE")
- save:setFunc(function()
- local pic = gp.new(1,1,w,h-4)
- gp.
- end)]]
- form:add(tbg)
- form:add(tfg)
- form:add(resetColors)
- form:add(exit)
- form:add(own)
- form:draw()
- form:listen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement