View difference between Paste ID: K4y0jhtN and eFF4g77x
SHOW: | | - or go back to the newest paste.
1
os.pullEvent = os.pullEventRaw
2
 
3
local w,h = term.getSize()
4
 
5
function printCentered( y,s )
6
   local x = math.floor((w - string.len(s)) / 2)
7
   term.setCursorPos(x,y)
8
   term.clearLine()
9
   term.write( s )
10
end
11
 
12
local nOption = 1
13
 
14
local function drawMenu()
15
   term.clear()
16
   term.setCursorPos(1,1)
17-
   term.write("Impending OS Alpha // ")
17+
   term.write("FoxOS by FoxWorn3365  |  2020")
18
term.setCursorPos(1,2)
19
shell.run("id")
20
 
21
   term.setCursorPos(w-11,1)
22
   if nOption == 1 then
23-
   term.write("Comandi")
23+
   term.write("Torna Indietro")
24
elseif nOption == 2 then
25-
   term.write("LeNet")
25+
   term.write("Nuovo Foglio")
26
elseif nOption == 3 then
27-
   term.write("WGet")
27+
   term.write("Nuovo Disegno")
28
elseif nOption == 4 then
29-
   term.write("ChatDistance")
29+
   term.write("Importa un Pastebin")
30
elseif nOption == 5 then
31-
   term.write("Spengi")
31+
   term.write("Usa la Console")
32-
elseif nOption == 6 then
32+
33-
   term.write("Disintalla FoxOS")
33+
34
 
35
end
36
 
37
--GUI
38
term.clear()
39
local function drawFrontend()
40
   printCentered( math.floor(h/2) - 3, "")
41
   printCentered( math.floor(h/2) - 2, "Utilità" )
42
   printCentered( math.floor(h/2) - 1, "")
43-
   printCentered( math.floor(h/2) - 2, "Start Menu" )
43+
   printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[ Torna Indietro ]") or "Torna Indietro" )
44
   printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[ Nuovo Foglio ]") or "Nuovo Foglio" )
45-
   printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[ Comandi ]") or "Comandi" )
45+
   printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ Nuovo Disegno ]") or "Nuovo Disegno" )
46-
   printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[ LeNet ]") or "LeNet" )
46+
   printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ Importa un Pastebin ]") or "Importa un Pastebin" )
47-
   printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ WGet ]") or "WGet" )
47+
   printCentered( math.floor(h/2) + 4, ((nOption == 5) and "[ Usa la Console ]") or "Usa la Console" )
48-
   printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ ChatDistance ]") or "ChatDistance" )
48+
49-
   printCentered( math.floor(h/2) + 4, ((nOption == 5) and "[ Spegni ]") or "Spegni" )
49+
50-
   printCentered( math.floor(h/2) + 5, ((nOption == 6) and "[ Disinstalla ]") or "Disinstalla" )
50+
51
drawMenu()
52
drawFrontend()
53
 
54
while true do
55
 sleep(0.1)
56
 local e,p = os.pullEvent()
57
 if e == "key" then
58
  local key = p
59
  if key == 17 or key == 200 then
60
 
61
   if nOption > 1 then
62
    nOption = nOption - 1
63
    drawMenu()
64
    drawFrontend()
65
   end
66
  elseif key == 31 or key == 308 then
67
  if nOption < 6 then
68
  nOption = nOption + 1
69
  drawMenu()
70
  drawFrontend()
71
end
72
elseif key == 28 then
73
    --End should not be here!!
74
break
75
end --End should be here!!
76
end
77
end
78
term.clear()
79
 
80
--Conditions
81
if nOption  == 1 then
82
shell.run(".FoxOS/.menu")
83
elseif nOption == 2 then
84
shell.run(".FoxOS/.newpaper")
85-
shell.run(".FoxOS/.command")
85+
86
shell.run(".FoxOS/.newpaint")
87-
shell.run(".FoxOS/.lenet")
87+
88
shell.run(".FoxOS/.pastebin")
89-
shell.run(".FoxOS/.wget")
89+
90
shell.run(".FoxOS/.console")
91-
shell.run(".FoxOS/.dc")
91+
92
shell.run(".FoxOS/.what")
93-
os.shutdown()
93+