Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local w,h = term.getSize()
- --Some draw functions to get us started
- local function printCentered(str, ypos)
- term.setCursorPos(w/2 - #str, ypos)
- term.write(str)
- end
- local function printRight(str, ypos)
- term.setCursorPos(w - #str, ypos)
- term.write(str)
- end
- --Add the menus here
- function drawMain()
- printCentered("Bees", 8)
- printCentered("Bottler", 10)
- printCentered("Credits", 12)
- printCentered("Shutdown", 14)
- local ypos = 9
- if select == 2 then ypos = 11
- elseif select == 3 then ypos = 13
- elseif select == 4 then ypos = 15 end
- printCentered("---------", ypos)
- end
- function drawHeader()
- printCentered("Auto Bee Mrk 1", 2)
- printCentered(string.rep("-", w), 3)
- printRight("by: superpowers414", h)
- end
- --Menu state
- local menustate = "main"
- select = 1
- local mopt = {
- ["main"] = {
- options = {"Bees", "Bottler", "Credits", "quit"},
- draw = drawMain
- }
- }
- --Run Function
- loop = true
- while loop==true do
- term.clear()
- drawHeader()
- mopt[menustate].draw()
- local id, key = os.pullEvent("key")
- if key == 200 and select > 1 then
- select = select-1
- elseif key == 208 and select < #mopt[menustate].options then
- select = select+1
- elseif key == 28 then
- if #mopt[menustate].options[select] == "quit" then
- loop = false
- else
- menustate = #mopt[menustate].options[select]
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment