SHOW:
|
|
- or go back to the newest paste.
| 1 | ---- By: Goodle | |
| 2 | ||
| 3 | -- Variables | |
| 4 | ||
| 5 | width, height = term.getSize() | |
| 6 | ||
| 7 | CnWidth = width / 2 | |
| 8 | CnHeight = height / 2 | |
| 9 | ||
| 10 | time = os.time() | |
| 11 | formattedTime = textutils.formatTime( time, false) | |
| 12 | ||
| 13 | isMenu = false | |
| 14 | isDesktop = false | |
| 15 | isStartup = false | |
| 16 | ||
| 17 | -- Functions | |
| 18 | ||
| 19 | startup = function() | |
| 20 | isStartup = true | |
| 21 | term.clear() | |
| 22 | term.setCursorPos(CnWidth-5,height-1) | |
| 23 | term.setTextColour( colours.blue ) | |
| 24 | term.write("WaffgoOS by")
| |
| 25 | term.setCursorPos(CnWidth-20,height) | |
| 26 | term.write("Goodle Software - In cooperation with CPGGC")
| |
| 27 | term.setCursorPos(CnWidth-3,CnHeight-1) | |
| 28 | term.setTextColour( colours.lightBlue ) | |
| 29 | term.write("Loading")
| |
| 30 | term.setCursorPos(CnWidth-6,CnHeight) | |
| 31 | term.write(";")
| |
| 32 | term.setCursorPos(CnWidth+6,CnHeight) | |
| 33 | term.write(";")
| |
| 34 | term.setBackgroundColour( colours.black ) | |
| 35 | term.setCursorPos(CnWidth,CnHeight+1) | |
| 36 | term.write('0%')
| |
| 37 | sleep(1) | |
| 38 | paintutils.drawLine(CnWidth-5,CnHeight, CnWidth,CnHeight, colours.green ) | |
| 39 | term.setBackgroundColour( colours.black ) | |
| 40 | term.setCursorPos(CnWidth-1,CnHeight+1) | |
| 41 | term.write("50%")
| |
| 42 | sleep(0.5) | |
| 43 | paintutils.drawLine(CnWidth,CnHeight, CnWidth+4,CnHeight, colours.green ) | |
| 44 | term.setBackgroundColour( colours.black ) | |
| 45 | term.setCursorPos(CnWidth-1,CnHeight+1) | |
| 46 | term.clearLine() | |
| 47 | term.write("78%")
| |
| 48 | sleep(0.3) | |
| 49 | term.setCursorPos(CnWidth-1,CnHeight+1) | |
| 50 | term.clearLine() | |
| 51 | term.write("80%")
| |
| 52 | sleep(0.5) | |
| 53 | paintutils.drawLine(CnWidth+4,CnHeight, CnWidth+5,CnHeight, colours.green ) | |
| 54 | term.setBackgroundColour( colours.black ) | |
| 55 | term.setCursorPos(CnWidth-1,CnHeight+1) | |
| 56 | term.clearLine() | |
| 57 | term.write("100%")
| |
| 58 | term.setCursorPos(CnWidth-3,CnHeight-1) | |
| 59 | term.clearLine() | |
| 60 | term.setBackgroundColour( colours.black ) | |
| 61 | term.write("Welcome!")
| |
| 62 | sleep(3) | |
| 63 | isStartup = false | |
| 64 | desktop() | |
| 65 | end | |
| 66 | ||
| 67 | ||
| 68 | desktop = function() | |
| 69 | ||
| 70 | isDesktop = true | |
| 71 | term.clear() | |
| 72 | pixelsDown = 1 | |
| 73 | pixelsDownLimit = height | |
| 74 | -- Desktop drawing | |
| 75 | ||
| 76 | while pixelsDown ~= height | |
| 77 | do paintutils.drawLine(1,pixelsDown, width,pixelsDown, colours.white ) | |
| 78 | pixelsDown = pixelsDown + 1 | |
| 79 | end | |
| 80 | paintutils.drawLine(1,height, width,height, colours.blue ) | |
| 81 | term.setCursorPos(1,height) | |
| 82 | term.setTextColour( colours.white ) | |
| 83 | term.setBackgroundColour( colours.lime ) | |
| 84 | term.write(' @ menu ')
| |
| 85 | ||
| 86 | -- Clock Drawing | |
| 87 | ||
| 88 | term.setCursorPos(width-6,height) | |
| 89 | term.setTextColour( colours.white ) | |
| 90 | term.setBackgroundColour( colours.blue ) | |
| 91 | term.write(formattedTime) | |
| 92 | ||
| 93 | -- Text Input Impeder | |
| 94 | ||
| 95 | while isDesktop == true do | |
| 96 | desktop2() | |
| 97 | term.setBackgroundColour( colours.white ) | |
| 98 | term.setCursorPos(0,0) | |
| 99 | term.setCursorBlink(false) | |
| 100 | local event, click, x, y = os.pullEvent("mouse_click")
| |
| 101 | if x == 2 then | |
| 102 | if y == height then | |
| 103 | break | |
| 104 | end | |
| 105 | end | |
| 106 | end | |
| 107 | end | |
| 108 | ||
| 109 | desktop2 = function() | |
| 110 | ||
| 111 | isDesktop = true | |
| 112 | pixelsDown = 1 | |
| 113 | pixelsDownLimit = height | |
| 114 | -- Desktop drawing | |
| 115 | ||
| 116 | while pixelsDown ~= height | |
| 117 | do paintutils.drawLine(1,pixelsDown, width,pixelsDown, colours.white ) | |
| 118 | pixelsDown = pixelsDown + 1 | |
| 119 | end | |
| 120 | paintutils.drawLine(1,height, width,height, colours.blue ) | |
| 121 | term.setCursorPos(1,height) | |
| 122 | term.setTextColour( colours.white ) | |
| 123 | term.setBackgroundColour( colours.lime ) | |
| 124 | term.write(' @ menu ')
| |
| 125 | ||
| 126 | -- Clock Drawing | |
| 127 | ||
| 128 | term.setCursorPos(width-6,height) | |
| 129 | term.setTextColour( colours.white ) | |
| 130 | term.setBackgroundColour( colours.blue ) | |
| 131 | term.write(formattedTime) | |
| 132 | end | |
| 133 | ||
| 134 | ||
| 135 | drawWindow = function() | |
| 136 | term.clear() | |
| 137 | end | |
| 138 | ||
| 139 | ||
| 140 | drawMenu = function() | |
| 141 | isMenu = true | |
| 142 | local menuPD = 2 -- Menu pixels down | |
| 143 | local menuPDL = height-1 -- Menu pixels down limit | |
| 144 | local menuPUL = height-10 -- Menu pixels up limit | |
| 145 | -- Menu pixels right limit is = 15 | |
| 146 | while menuPD < menuPDL do | |
| 147 | paintutils.drawLine(1, menuPUL, 15, menuPUL, 400 ) | |
| 148 | menuPUL = menuPUL + 1 | |
| 149 | menuPD = menuPD + 1 | |
| 150 | end -- Dimensions of menu: w-15 from left, h-9 from height - 1 | |
| 151 | term.setCursorPos(1,height) | |
| 152 | term.setTextColour( colours.white ) | |
| 153 | term.setBackgroundColour( colours.green ) | |
| 154 | term.write(" @ menu ")
| |
| 155 | ||
| 156 | paintutils.drawLine(9,height, 15,height, colours.blue ) | |
| 157 | term.setCursorPos(2,height-1) | |
| 158 | term.setBackgroundColour( 400 ) | |
| 159 | term.setTextColour( colours.yellow ) | |
| 160 | term.write("@ Exit") -- Logoff button
| |
| 161 | term.setCursorPos(2,height-2) | |
| 162 | term.setTextColour( colours.red ) | |
| 163 | term.write("@ Shutdown") -- Shutdown button
| |
| 164 | term.setCursorPos(2,height-3) | |
| 165 | term.setTextColour( colours.green ) | |
| 166 | term.write("@ TMNET") -- Shutdown button
| |
| 167 | ||
| 168 | term.setBackgroundColour( colours.white ) | |
| 169 | while isMenu == true do | |
| 170 | local event, click2, x, y = os.pullEvent("mouse_click")
| |
| 171 | if x == 2 and y == height then | |
| 172 | isMenu = false | |
| 173 | desktop() | |
| 174 | break | |
| 175 | end | |
| 176 | if x == 2 then | |
| 177 | if y == height-1 then | |
| 178 | isMenu = false | |
| 179 | isStartup = false | |
| 180 | isDesktop = false | |
| 181 | exit() | |
| 182 | end | |
| 183 | end | |
| 184 | if x == 2 then | |
| 185 | if y == height-2 then | |
| 186 | os.shutdown() | |
| 187 | end | |
| 188 | end | |
| 189 | if x == 2 then | |
| 190 | if y == height-3 then | |
| 191 | shell.run("web")
| |
| 192 | isMenu = false | |
| 193 | desktop() | |
| 194 | break | |
| 195 | end | |
| 196 | end | |
| 197 | end | |
| 198 | end | |
| 199 | ||
| 200 | exit = function() | |
| 201 | term.clear() | |
| 202 | term.setBackgroundColour(colours.black) | |
| 203 | term.setTextColour(colours.white) | |
| 204 | term.setCursorPos(1,1) | |
| 205 | term.clear() | |
| 206 | end | |
| 207 | -- Program execution | |
| 208 | ||
| 209 | startup() | |
| 210 | ||
| 211 | drawMenu() | |
| 212 | ||
| 213 | while isDesktop == true do | |
| 214 | drawMenu() | |
| 215 | end |