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("LUA")
- elseif nOption == 3 then
- term.write("Monitors")
- elseif nOption == 4 then
- term.write("MKDir")
- elseif nOption == 5 then
- term.write("Copia")
- elseif nOption == 6 then
- term.write("Sposta")
- elseif nOption == 7 then
- term.write("Elimina")
- elseif nOption == 8 then
- term.write("Help")
- else
- end
- end
- --GUI
- term.clear()
- local function drawFrontend()
- printCentered( math.floor(h/2) - 3, "")
- printCentered( math.floor(h/2) - 2, "Menu Principale" )
- printCentered( math.floor(h/2) - 1, "")
- printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[ Menu Principale ]") or "Menu Principale" )
- printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[ Interfaccia LUA ]") or "Interfaccia LUA" )
- printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ Monitors ]") or "Monitors" )
- printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ MKDir ]") or "MKDir" )
- printCentered( math.floor(h/2) + 4, ((nOption == 5) and "[ Copia ]") or "Copia" )
- printCentered( math.floor(h/2) + 5, ((nOption == 6) and "[ Sposta ]") or "Sposta" )
- printCentered( math.floor(h/2) + 6, ((nOption == 7) and "[ Cancella ]") or "Cancella" )
- printCentered( math.floor(h/2) + 7, ((nOption == 8) and "[ Aiuto Comandi ]") or "Aiuto Comandi" )
- 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
- print("")
- if nOption > 1 then
- nOption = nOption - 1
- drawMenu()
- drawFrontend()
- end
- elseif key == 31 or key == 208 then
- if nOption < 8 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/.lua")
- elseif nOption == 3 then
- shell.run(".FoxOS/.monitors")
- elseif nOption == 4 then
- shell.run(".FoxOS/.mkdir")
- elseif nOption == 5 then
- shell.run(".FoxOS/.copy")
- elseif nOption == 6 then
- shell.run(".FoxOS/.move")
- elseif nOption == 7 then
- shell.run(".FoxOS/.rm")
- elseif nOption == 8 then
- shell.run(".FoxOS/.ie")
- else
- shell.run(".FoxOS/.what")
- end
Add Comment
Please, Sign In to add comment