Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Подключение нужных модулей--
- local com = require("component")
- local gpu = com.gpu
- local term = require("term")
- local event = require("event")
- local colors = require("colors")
- local kb = require("keyboard")
- --Главные граф. настройки и сохранение старых--
- OldB = gpu.getBackground()
- OldF = gpu.getForeground()
- OldW,OldH = gpu.getResolution()
- gpu.maxResolution()
- NewW,NewH = gpu.getResolution()
- gpu.setBackground(colors.green,true)
- gpu.setForeground(colors.black,true)
- term.clear()
- --ГРАФИКА КНОПОК--
- --Заголовок--
- gpu.setBackground(colors.orange,true)
- term.setCursor(NewW/2-5,2)
- gpu.setForeground(colors.magenta,true)
- term.write("Jakes Bong")
- --Продолжить--
- gpu.setBackground(colors.silver,true)
- term.setCursor(NewW/2-5,4)
- gpu.setForeground(0x942f57)
- term.write("Продолжить")
- --Начать новую игру--
- gpu.setBackground(colors.silver,true)
- term.setCursor(NewW/2-8.5,6)
- gpu.setForeground(0x942f57)
- term.write("Начать новую игру")
- --Настройки--
- gpu.setBackground(colors.silver,true)
- term.setCursor(NewW/2-4.5,8)
- gpu.setForeground(0x942f57)
- term.write("Настройки")
- --Авторы--
- gpu.setBackground(colors.silver,true)
- term.setCursor(NewW/2-3,10)
- gpu.setForeground(0x942f57)
- term.write("Автор")
- --Выход--
- gpu.setBackground(colors.silver,true)
- term.setCursor(NewW/2-2.5,12)
- gpu.setForeground(0x942f57)
- term.write("Выход")
- --Захват касаний в меню--
- Touch,ScreenA,ScreenX,ScreenY,T,nick = event.pull("touch")
- term.setCursor(1,14)
- print(ScreenX,ScreenY)
- --ФУНКЦИОНАЛЬНОСТЬ КНОПОК--
- --Кнопка "Начать новую игру"--
- if ScreenY==6 then
- if ScreenX>=31 and ScreenX<=47 then
- gpu.setBackground(colors.brown,true)
- gpu.setForeground(colors.silver,true)
- term.clear()
- end
- end
- --Кнопка "Настройки"--
- if ScreenY==8 then
- if ScreenX>=35 and ScreenX<=43 then
- gpu.setBackground(colors.green,true)
- SSRX,SSRY = gpu.getResolution()
- if SSRX==80 and SSRY==25 then
- SSIIX=60
- SSIIY=25
- end
- gpu.setBackground(colors.gray,true)
- gpu.fill(10,6,SSIIX,SSIIY," ")
- gpu.setBackground(colors.orange,true)
- gpu.setForeground(colors.magenta,true)
- gpu.fill(10,4,60,3," ")
- --САМИ НАСТРОЙКИ--
- --Управление--
- --Заголовок--
- term.setCursor(17,4)
- term.write("Управление")
- --Графика--
- --Заголовок--
- term.setCursor(32,4)
- term.write("Графика")
- end
- end
- --Стартовые координаты квадрата--
- SX=10
- SY=10
- --Главный цикл--
- while true do
- OSX=SX
- OSY=SY
- gpu.setBackground(colors.brown,true)
- Key,W,E,R,T,Y = event.pull("key_down")
- if Key and kb.isKeyDown(kb.keys.w) then
- SY=SY-1
- end
- if Key and kb.isKeyDown(kb.keys.s) then
- SY=SY+1
- end
- if Key and kb.isKeyDown(kb.keys.a) then
- SX=SX-2
- end
- if Key and kb.isKeyDown(kb.keys.d) then
- SX=SX+2
- end
- if Key and kb.isKeyDown(kb.keys.q) then
- --Менюшка в прямо в игре--
- gpu.setBackground(colors.gray,true)
- gpu.setForeground(colors.magenta,true)
- gpu.fill(30,4,10,10," ")
- term.setCursor(4,10)
- term.write("Продолжить")
- --Не закончено--
- break
- end
- if Key and kb.isKeyDown(kb.keys.e) then
- term.clear()
- end
- gpu.setBackground(colors.brown,true)
- gpu.fill(OSX,OSY,2,1," ")
- gpu.setBackground(colors.orange,true)
- gpu.fill(SX,SY,2,1," ")
- end
- --Возвращение предыдущих настроек--
- gpu.setBackground(OldB)
- gpu.setForeground(OldF)
- gpu.setResolution(OldW,OldH)
- term.clear()
- os.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement