Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local com = require("component")
- local gpu = com.gpu
- local comp = require("computer")
- local color = require("colors")
- local term = require("term")
- --Сохранение предыдущих настроек--
- local OldB = gpu.getBackground()
- local OldF = gpu.getForeground()
- local OldW,OldH = gpu.getResolution()
- --Установка новых настроек--
- local NewW,NewH = 160,42
- gpu.setResolution(NewW,NewH)
- term.clear()
- --НАЗНАЧЕНИЕ ФУНКЦИЙ--
- --Функции отрисовки--
- function textBox(x,y,text,colorB,colorF,hex)
- if hex == nil then
- if colorB ~= nil then
- gpu.setBackground(colorB,true)
- end
- if colorF ~= nil then
- gpu.setForeground(colorF,true)
- end
- else
- if colorB ~= nil then
- gpu.setBackground(colorB)
- end
- if colorF ~= nil then
- gpu.setForeground(colorF)
- end
- end
- gpu.set(x,y,tostring(text))
- end
- function drawHoriLine(y,colorB)
- if colorB ~= nil then
- gpu.setBackground(colorB,true)
- end
- gpu.fill(1,y,NewW,1," ")
- end
- function drawVertLine(x,y,colorB)
- if colorB ~= nil then
- gpu.setBackground(colorB,true)
- end
- gpu.fill(x,y,1,NewH," ")
- end
- --Создание статичного интерфейса--
- drawHoriLine(1,color.gray)
- textBox(71,1,"Visual Programming")
- textBox(1,1,"Файл")
- --Главный цикл--
- while true do
- local type,_,sX,sY,button,nick = comp.pullSignal(0)
- if type == "touch" then
- local FileOpen
- local CreateOpen
- if sX >= 1 and sX <= 5 then
- if sY >= 1 and sY <= 2 then
- textBox(1,1,"Файл",color.silver)
- textBox(1,2,"Выйти",color.gray)
- FileOpen = true
- end
- end
- if FileOpen then
- if sX >= 1 and sX <= 5 then
- if sY >= 1 and sY <= 2 then
- textBox(1,1,"Файл")
- gpu.setBackground(color.black)
- gpu.fill(1,2,5,1," ")
- end
- end
- end
- if sX >= 1 and sX <= 6 then
- if sY >= 2 and sY <= 3 then
- break
- end
- end
- if sY > 1 then
- if button == 1 then
- gpu.fill(sX,sY,7,1," ")
- textBox(sX,sY,"Создать",nil,color.black)
- CreateOpen = true
- PosCreate =
- {
- startX = sX,
- startY = sY,
- endX = sX + 7,
- endY = sY + 1,
- }
- end
- end
- --[[if PosCreate ~= nil then
- if not sX >= PosCreate.startX and sX <= PosCreate.endX then
- if not sY >= PosCreate.startY and sX <= PosCreate.endY then
- gpu.setBackground(color.black)
- gpu.fill(PosCreate.startX,PosCreate.startY,7,1," ")
- end
- end
- end]]
- end
- end
- --Возращение старых настроек--
- gpu.setResolution(OldW,OldH)
- gpu.setBackground(OldB)
- gpu.setForeground(OldF)
- term.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement