Marlingaming

Aperture Science OS Graphics - Setup Menu

Sep 24th, 2021
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. --this program acts as a Graphical Overlay to make the setup process look nicer
  2. local tArg = {...}
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. local w, h = term.getSize()
  6. local Stage = 0
  7. local Version_1 = "1.0"
  8. local Version_2 = "2.0"
  9. local Version_3 = nil
  10.  
  11. function CenterText(y,text)
  12. local x = math.floor((w - string.len(text)) /2)
  13. term.setCursorPos(x,y)
  14. term.clearLine()
  15. term.write(text)
  16. end
  17.  
  18. function SlowCenterText(y,text)
  19. local x = math.floor((w - string.len(text)) /2)
  20. term.setCursorPos(x,y)
  21. term.clearLine()
  22. textutils.slowWrite(text)
  23. end
  24.  
  25. function DrawBackground()
  26. term.clear()
  27. term.setCursorPos(1,1)
  28. paintutils.drawFilledBox(1,1,w,h,colors.blue)
  29. paintutils.drawBox(1,1,w,h,colors.gray)
  30. paintutils.drawPixel(2,2,colors.red)
  31. end
  32.  
  33. function DrawMenu()
  34. CenterText(2,"--Setup---Menu--")
  35. term.setCursorPos(1,3)
  36. if Stage == 0 then
  37. print("SYSTEM SETUP")
  38. print("Please Enter your desired version")
  39. print("1 - "..Version_1)
  40. print("2 - "..Version_2)
  41. print("3 - "..Version_3)
  42. SetupInteraction_1()
  43. elseif Stage == 1 then
  44. print("Starting Security Search")
  45. print("please wait while your ComputerCraft Device is searched")
  46. print("For any Harmful or insecure Programs")
  47. CenterText(7,"Security Search")
  48. SlowCenterText(8,"Searching...Searching...Searching...")
  49. sleep(1)
  50. DrawBar(2,10,0.05)
  51. sleep(2)
  52. DrawBar(2,10,0.1)
  53. sleep(1)
  54. DrawBar(2,10,0.35)
  55. sleep(2)
  56. DrawBar(2,10,0.60)
  57. sleep(4)
  58. DrawBar(2,10,0.9)
  59. sleep(2)
  60. DrawBar(2,10,1)
  61. sleep(1)
  62. Centertext(11,"Completed!")
  63. sleep(2)
  64. Stage = 2
  65. elseif Stage == 2 then
  66.  
  67. elseif Stage == 3 then
  68.  
  69. end
  70. if Stage < 4 then
  71. DrawBackground()
  72. DrawMenu()
  73. end
  74. end
  75.  
  76. function DrawBar(x,y,Progress)
  77. local Position = (w-x)*Progress
  78. paintutils.drawFilledBox(x,y,Position-x,y+3,colors.green)
  79. end
  80.  
  81. function SetupInteraction_1()
  82. while true do
  83. local event, key = os.pullEvent("key")
  84. if key == keys.one then
  85.  
  86. break
  87. elseif key == keys.two and Version_2 ~= nil then
  88.  
  89. break
  90. elseif key == keys.three and Version_3 ~= nil then
  91.  
  92. break
  93. end
  94. end
  95. end
  96.  
  97.  
  98. if tArg[1] == "Start" then
  99. Stage = 0
  100. elseif tArg[1] == "Finished" then
  101. Stage = 3
  102. end
  103. DrawBackGround()
  104. DrawMenu()
  105.  
Advertisement
Add Comment
Please, Sign In to add comment