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("FoxOS by FoxWorn3365 | 2020")
- term.setCursorPos(1,2)
- shell.run("id")
- term.setCursorPos(w-11,1)
- if nOption == 1 then
- term.write("Indietro")
- elseif nOption == 2 then
- term.write("Nuovo Foglio")
- elseif nOption == 3 then
- term.write("Files")
- elseif nOption == 4 then
- term.write("WGet")
- elseif nOption == 5 then
- term.write("PasteBin")
- elseif nOption == 6 then
- term.write("Console")
- else
- end
- end
- --GUI
- term.clear()
- local function drawFrontend()
- printCentered( math.floor(h/2) - 3, "")
- printCentered( math.floor(h/2) - 2, "UtilitåA0" )
- printCentered( math.floor(h/2) - 1, "")
- printCentered( math.floor(h/2) + 0, ((nOption == 1) and "> Torna Indietro") or "Torna Indietro" )
- printCentered( math.floor(h/2) + 1, ((nOption == 2) and "> Nuovo Foglio") or "Nuovo Foglio" )
- printCentered( math.floor(h/2) + 2, ((nOption == 3) and "> Visualizza i File") or "Visualizza i File" )
- printCentered( math.floor(h/2) + 3, ((nOption == 4) and "> Visualizza Pacchetti WGet") or "Visualizza Pacchetti WGet" )
- printCentered( math.floor(h/2) + 4, ((nOption == 5) and "> Importa un Pastebin") or "Importa un Pastebin" )
- printCentered( math.floor(h/2) + 5, ((nOption == 6) and "> Usa la Console") or "Usa la Console" )
- end
- --Display
- drawMenu()
- drawFrontend()
- while true do
- sleep(0.1)
- local e,p = os.pullEvent()
- if e == "key" then
- local key = p
- if key == 17 or key == 200 then
- if nOption > 1 then
- nOption = nOption - 1
- drawMenu()
- drawFrontend()
- end
- elseif key == 31 or key == 208 then
- if nOption < 6 then
- nOption = nOption + 1
- drawMenu()
- drawFrontend()
- end
- elseif key == 28 then
- --End should not be here!!
- break
- end --End should be here!!
- end
- end
- term.clear()
- --Conditions
- if nOption == 1 then
- shell.run(".FoxOS/.menu")
- elseif nOption == 2 then
- shell.run(".FoxOS/.newpaper")
- elseif nOption == 3 then
- shell.run(".FoxOS/.files")
- elseif nOption == 4 then
- shell.run(".FoxOS/.wgetlist")
- elseif nOption == 5 then
- shell.run(".FoxOS/.pastebin")
- elseif nOption == 6 then
- shell.run(".FoxOS/.console")
- else
- shell.run(".FoxOS/.what")
- end
Advertisement
Add Comment
Please, Sign In to add comment