SHOW:
|
|
- or go back to the newest paste.
| 1 | -- Handheld Operating System by Goodle Software | |
| 2 | ||
| 3 | -- VARIABLES | |
| 4 | w,h=term.getSize() | |
| 5 | ||
| 6 | cw = w/2 | |
| 7 | ||
| 8 | ch = h/2 | |
| 9 | ||
| 10 | notif = false -- if a notification is present | |
| 11 | ||
| 12 | time = os.time() | |
| 13 | formattedTime = textutils.formatTime( time, false) | |
| 14 | ||
| 15 | -- FUNCTIONS | |
| 16 | homeScreen=function() | |
| 17 | ||
| 18 | local pD = 1 -- Pixels Down | |
| 19 | ||
| 20 | term.clear() | |
| 21 | ||
| 22 | while pD <= h do | |
| 23 | paintutils.drawLine(1,pD, w,pD, colours.cyan ) | |
| 24 | pD = pD + 1 | |
| 25 | end | |
| 26 | ||
| 27 | term.setCursorPos(w-1,h-1) | |
| 28 | term.setBackgroundColour( colours.cyan ) | |
| 29 | term.setTextColour( colours.white ) | |
| 30 | term.write("#")
| |
| 31 | ||
| 32 | paintutils.drawLine(1,1, w,1, colours.blue ) | |
| 33 | term.setCursorPos(2,1) | |
| 34 | ||
| 35 | if notif==true | |
| 36 | then term.write("!")
| |
| 37 | else | |
| 38 | term.write(" ")
| |
| 39 | end | |
| 40 | term.setCursorPos(0,0) | |
| 41 | - | term.setCursorPos(w-6,1) |
| 41 | + | |
| 42 | - | term.write(formattedTime) |
| 42 | + | |
| 43 | read("")
| |
| 44 | end | |
| 45 | ||
| 46 | end | |
| 47 | ||
| 48 | startup=function() | |
| 49 | ||
| 50 | term.clear() | |
| 51 | ||
| 52 | term.setBackgroundColour( colours.cyan ) | |
| 53 | term.setTextColour( colours.white ) | |
| 54 | term.setCursorPos(cw-1,ch) | |
| 55 | term.write(" G ")
| |
| 56 | term.setCursorPos(cw-1,ch+1) | |
| 57 | term.write(" S ")
| |
| 58 | term.setCursorPos(cw-1,ch+2) | |
| 59 | term.setBackgroundColour( colours.blue ) | |
| 60 | term.write(" ")
| |
| 61 | term.setCursorPos(cw-2,ch+1) | |
| 62 | term.write(" ")
| |
| 63 | term.setCursorPos(cw-2,ch+2) | |
| 64 | term.write(" ")
| |
| 65 | ||
| 66 | term.setBackgroundColour( colours.black ) | |
| 67 | term.setTextColour( colours.white) | |
| 68 | ||
| 69 | sleep(5) | |
| 70 | ||
| 71 | end | |
| 72 | ||
| 73 | clock = function() | |
| 74 | time = os.time() | |
| 75 | formattedTime = textutils.formatTime( time, false) | |
| 76 | local clockwin = window.create(term.current(),w-6,1,6,1) | |
| 77 | while true do | |
| 78 | clockwin.setBackgroundColour( colours.blue ) | |
| 79 | clockwin.setCursorPos(w-6, 1) | |
| 80 | clockwin.write(formattedTime) | |
| 81 | - | homeScreen() |
| 81 | + | os.sleep(1) |
| 82 | end | |
| 83 | end | |
| 84 | ||
| 85 | -- EXECUTION | |
| 86 | ||
| 87 | startup() | |
| 88 | clock() | |
| 89 | parallel.waitForAny(homeScreen(), clock()) |