Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local w,h = term.getSize()
- local function printCentered (y,s)
- local x = math.floor((w - string.len(s)) / 2)
- term.setCursorPos(x,y)
- term.clearLine()
- term.write(s)
- local nOption = 1
- local function drawMenu()
- term.clear()
- term.setCursorPos(1,1)
- term.write("MinerOS V1.0")
- term.setCursorPos(1,2)
- term.setCursorPos(w-11,1)
- if nOption == 1 then
- term.write("Command Prompt")
- elseif nOption == 2 then
- term.write("Applications")
- elseif nOption == 3 then
- term.write("Power Options")
- elseif nOption == 4 then
- term.write("File Viewer")
- elseif nOption == 5 then
- term.write("Uninstall :(")
- else
- end
- end
- --GUI lol
- term.setBackgroundColor(colors.orange)
- term.clear()
- local function drawFrontend()
- printCentered(math.floor(h/2) - 3, "")
- printCentered(math.floor(h/2) - 2, "Start Menu")
- printCentered(math.floor(h/2) - 1, "")
- printCentered(math.floor(h/2) + 0, ((nOption == 1) and "> Command Prompt <") or "Command Prompt")
- printCentered(math.floor(h/2) + 1, ((nOption == 2) and "> Applications <") or "Applications")
- printCentered(math.floor(h/2) + 2, ((nOption == 3) and "> Power Options <") or "Power Options")
- printCentered(math.floor(h/2) + 3, ((nOption == 4) and "> File Viewer <") or "File Viewer")
- printCentered(math.floor(h/2) + 4, ((nOption == 5) and "> Uninstall :( <") or "Uninstall :(")
- printCentered(math.floor(h/2) + 5, "")
- end
- --Display uit please fghklfgnhmfgnhlkgfnl
- drawMenu()
- drawFrontEnd()
- while true do
- local e,p = os.pullEvent()
- if e == "keys" then
- local keys = p
- if keys == 17 or keys == 200 then
- if nOption > 1 then
- nOption = nOption + 1
- drawMenu()
- drawFrontend()
- end
- elseif keys == 31 or keys == 209 then
- if nOption < 5 then
- nOption = nOption + 1
- drawMenu()
- drawFrontend()
- end
- elseif keys == 28 then
- break
- end
- end
- end
- term.clear()
- --Conditons
- if nOption == 1 then
- exit()
- elseif nOption == 2 then
- print("wait for next version!!11!!")
- elseif nOption == 3 then
- os.shutdown()
- elseif nOption == 4 then
- print("not eyt !!!@!@@2465234652436")
- else
- print("soon")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment