SHOW:
|
|
- or go back to the newest paste.
1 | os.pullEvent = os.pullEventRaw | |
2 | shell.run(".settings") | |
3 | ||
4 | local w,h = term.getSize() | |
5 | ||
6 | function printCentered( y,s ) | |
7 | local x = math.floor((w - string.len(s)) / 2) | |
8 | term.setCursorPos(x,y) | |
9 | term.clearLine() | |
10 | term.write( s ) | |
11 | end | |
12 | ||
13 | local nOption = 1 | |
14 | ||
15 | local function drawMenu() | |
16 | term.clear() | |
17 | term.setCursorPos(1,1) | |
18 | - | term.write("Impending OS Alpha // ") |
18 | + | term.write("MagmaOS Alpha // ") |
19 | term.setCursorPos(1,2) | |
20 | shell.run("id") | |
21 | ||
22 | term.setCursorPos(w-11,1) | |
23 | if nOption == 1 then | |
24 | term.write("Command") | |
25 | elseif nOption == 2 then | |
26 | term.write("Programs") | |
27 | elseif nOption == 3 then | |
28 | term.write("Settings") | |
29 | elseif nOption == 4 then | |
30 | - | term.write("Uninstall") |
30 | + | |
31 | else | |
32 | end | |
33 | ||
34 | end | |
35 | ||
36 | --GUI | |
37 | term.clear() | |
38 | local function drawFrontend() | |
39 | printCentered( math.floor(h/2) - 3, "") | |
40 | printCentered( math.floor(h/2) - 2, "Start Menu" ) | |
41 | printCentered( math.floor(h/2) - 1, "") | |
42 | - | printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[ Command ]") or "Command" ) |
42 | + | printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[ Command ]") or "Command " ) |
43 | printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[ Programs ]") or "Programs" ) | |
44 | - | printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ Shutdown ]") or "Shutdown" ) |
44 | + | printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ Settings ]") or "Settings" ) |
45 | - | printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ Uninstall]") or " Uninstall" ) |
45 | + | printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ Shutdown ]") or "Shutdown" ) |
46 | printCentered( math.floor(h/2) + 4, "") | |
47 | end | |
48 | ||
49 | --Display | |
50 | drawMenu() | |
51 | drawFrontend() | |
52 | ||
53 | while true do | |
54 | local e,p = os.pullEvent() | |
55 | if e == "key" then | |
56 | local key = p | |
57 | if key == 17 or key == 200 then | |
58 | ||
59 | if nOption > 1 then | |
60 | nOption = nOption - 1 | |
61 | drawMenu() | |
62 | drawFrontend() | |
63 | end | |
64 | elseif key == 31 or key == 208 then | |
65 | if nOption < 4 then | |
66 | nOption = nOption + 1 | |
67 | drawMenu() | |
68 | drawFrontend() | |
69 | end | |
70 | elseif key == 28 then | |
71 | - | --End should not be here!! |
71 | + | |
72 | break | |
73 | - | end --End should be here!! |
73 | + | end |
74 | end | |
75 | end | |
76 | term.clear() | |
77 | ||
78 | --Conditions | |
79 | if nOption == 1 then | |
80 | - | shell.run("ios/.command") |
80 | + | shell.run(".clear") |
81 | elseif nOption == 2 then | |
82 | - | shell.run("ios/.programs") |
82 | + | shell.run(".programs") |
83 | elseif nOption == 3 then | |
84 | shell.run(".changeLogin") | |
85 | elseif nOption == 4 then | |
86 | - | shell.run("ios/.UninstallDialog") |
86 | + | |
87 | end |