Advertisement
LSLCNR

Untitled

Nov 12th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. local sg = peripheral.wrap("right")
  2.  
  3. local favAddresses = {
  4. {
  5. title = "",
  6. address = ""
  7. }
  8. }
  9.  
  10. local event, p1, p2, p3 = nil
  11. local screenSelection = 0
  12. local screen = nil
  13.  
  14. function resetScreen()
  15. term.clear()
  16. term.setBackgroundColor(colors.gray)
  17. term.setTextColor(colors.black)
  18. term.setCursorPos(1, 1)
  19. end
  20.  
  21. function Print(text, x, y)
  22. term.setCursorPos(x, y)
  23. term.write(text)
  24. end
  25.  
  26. function drawScreen(screenSettings)
  27. resetScreen()
  28.  
  29. term.setBackgroundColor(colors.white)
  30. for i = 1, 3, 1
  31. do
  32. term.setCursorPos(1, i)
  33. term.clearLine()
  34. end
  35. Print(screenSettings["title"], getCenterX(screenSettings["title"]), 2)
  36. term.setBackgroundColor(colors.gray)
  37. end
  38.  
  39. function getCenterX(text)
  40. local x,_ = term.getSize()
  41. return math.floor((x / 2) - (string.len(text) / 2))
  42. end
  43.  
  44. function startup()
  45. screen = {
  46. title = "Stargate Control Program"
  47. options = {
  48. {
  49. option = "Dial Favorite",
  50. func = dialFavoriteScreen
  51. },
  52. {
  53. option = "Dial Manually",
  54. func = dialFavoriteScreen
  55. },
  56. {
  57. option = "Exit",
  58. func = exitProgram
  59. }
  60. }
  61. }
  62. end
  63.  
  64. function dialFavoriteScreen()
  65.  
  66. end
  67.  
  68. function exitProgram()
  69. computer.reboot()
  70. end
  71.  
  72. function awaitEvent()
  73. event, p1, p2, p3 = os.pullEvent()
  74. end
  75.  
  76. function isSelectionChanged()
  77. if event == "key" then
  78. if p1 == keys.up then
  79.  
  80. end
  81. end
  82. end
  83.  
  84. startup()
  85.  
  86. while true do
  87. awaitEvent()
  88. drawScreen(screen)
  89. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement