Advertisement
Good_Pudge

Visual Graphic

Sep 15th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. local fs = require("filesystem")
  2. local gp,threads
  3.  
  4. if not fs.isDirectory("/lib/GPAPI.lua") then
  5.     os.execute("pastebin get ZV2gqMJH /lib/GPAPI.lua")
  6. end
  7.  
  8. if not fs.isDirectory("/lib/thread.lua") then
  9.     os.execute("pastebin get E0SzJcCx /lib/thread.lua")
  10. end
  11.  
  12. local gp = require("GPAPI")
  13. local com,gpu,term,color,comp = gp.require()
  14. local thread = require("thread")
  15.  
  16. --Графические преднастройки--
  17. local OldB,OldF,OldW,OldH = gp.saveOld()
  18. gpu.setBackground(color.gray,true)
  19. gpu.setForeground(color.silver,true)
  20. gpu.setResolution(160,42)
  21. term.clear()
  22.  
  23. --Переменные--
  24. W,H = 160,42
  25.  
  26. --Функции--
  27. function option(sX,sY,x,y,weidth,height,colorB,colorF,hex)
  28.     local w = weidth
  29.     local h = height
  30.     local dX,dY = w,h
  31.     gp.cnsColor(colorB,colorF,hex)
  32.  
  33.     if sX >= x and sX < x + weidth then
  34.         if sY >= y and sY < y + height then
  35.             while true do
  36.  
  37.                 local oldX,oldY = sX,sY
  38.  
  39.                 --Левый верхний угол--
  40.                 if sX >= x and sX < x + 2 then
  41.                     if sY >= y and sY < y + 2 then
  42.  
  43.                         if sX < oldX then
  44.                             dX = dX - 1
  45.                         end
  46.  
  47.                         if sY > oldY then
  48.                             dY = dY + 1
  49.                         end
  50.                     end
  51.                 end
  52.  
  53.                 gpu.fill(x,y,dX,dY," ")
  54.             end
  55.         else
  56.             goto Exit
  57.         end
  58.     end
  59.  
  60.     ::Exit::
  61. end
  62.  
  63. --Статичный интерфейс
  64. gp.textbox(150,41,"Выйти",_,color.gray,color.red)
  65.  
  66. --Главный цикл--
  67. while true do
  68.     local type,_,x,y,button,_ = comp.pullSignal() --Касания, удержания, бросания
  69.  
  70.     --Кнопички--
  71.  
  72.     --Прочее--
  73.     option(x,y,30,10,7,3)
  74.  
  75.     if sX >= 150 and sX < 155 then
  76.         if sY >= 41 and sY < 42 then
  77.             break
  78.         end
  79.     end
  80. end
  81.  
  82. --Возвращение настроек--
  83. gp.setOld(OldB,OldF,OldW,OldH)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement