Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sg = peripheral.wrap("right")
- local favAddresses = {
- {
- title = "",
- address = ""
- }
- }
- local event, p1, p2, p3 = nil
- local screenSelection = 0
- local screen = nil
- function resetScreen()
- term.clear()
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.black)
- term.setCursorPos(1, 1)
- end
- function Print(text, x, y)
- term.setCursorPos(x, y)
- term.write(text)
- end
- function drawScreen(screenSettings)
- resetScreen()
- term.setBackgroundColor(colors.white)
- for i = 1, 3, 1
- do
- term.setCursorPos(1, i)
- term.clearLine()
- end
- Print(screenSettings["title"], getCenterX(screenSettings["title"]), 2)
- term.setBackgroundColor(colors.gray)
- end
- function getCenterX(text)
- local x,_ = term.getSize()
- return math.floor((x / 2) - (string.len(text) / 2))
- end
- function startup()
- screen = {
- title = "Stargate Control Program"
- options = {
- {
- option = "Dial Favorite",
- func = dialFavoriteScreen
- },
- {
- option = "Dial Manually",
- func = dialFavoriteScreen
- },
- {
- option = "Exit",
- func = exitProgram
- }
- }
- }
- end
- function dialFavoriteScreen()
- end
- function exitProgram()
- computer.reboot()
- end
- function awaitEvent()
- event, p1, p2, p3 = os.pullEvent()
- end
- function isSelectionChanged()
- if event == "key" then
- if p1 == keys.up then
- end
- end
- end
- startup()
- while true do
- awaitEvent()
- drawScreen(screen)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement