Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local w,h = term.getSize()
- function printCentered( y,s )
- local x = math.floor((w - string.len(s)) / 2)
- term.setCursorPos(x,y)
- term.clearLine()
- term.write( s )
- end
- local nOption = 1
- local function drawMenu()
- term.clear()
- term.setCursorPos(1,1)
- term.write("Diamond OS // 1.2.0 // ")
- term.setCursorPos(1,2)
- shell.run("id")
- term.setCursorPos(w-11,1)
- if nOption == 1 then
- term.write("Back")
- else
- end
- end
- --GUI
- term.clear()
- local function drawFrontend()
- printCentered( math.floor(h/2) - 3, "")
- printCentered( math.floor(h/2) - 2, "About" )
- printCentered( math.floor(h/2) - 1, "")
- printCentered( math.floor(h/2) + 0, "Name : DiamondOS")
- printCentered( math.floor(h/2) + 1, "Manu. : LINC ")
- printCentered( math.floor(h/2) + 2, "Vers. : 1.2.0 ")
- printCentered( math.floor(h/2) + 3, "")
- printCentered( math.floor(h/2) + 4, ((nOption == 1) and "[ Back ]") or " Back" )
- end
- --Display
- drawMenu()
- drawFrontend()
- while true do
- local e,p = os.pullEvent("key")
- if p == keys.up then
- if nOption > 1 then
- nOption = nOption - 1
- drawMenu()
- drawFrontend()
- end
- elseif p == keys.down then
- if nOption < 1 then
- nOption = nOption + 1
- drawMenu()
- drawFrontend()
- end
- elseif p == keys.enter then
- break
- end
- end
- term.clear()
- --Conditions
- if nOption == 1 then
- shell.run("/bin/main")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement