From a0b298a29fe83ab93dfb9bb4dab3bbd1c574d932 Mon Sep 17 00:00:00 2001 From: Alee Date: Tue, 5 Mar 2019 10:07:23 -0500 Subject: Added the desktop and move the boot up sequence to it's own file --- startup | 55 +---------------------------------------------- system/boot.lua | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ system/desktop.lua | 32 ++++++++++++++++++++++----- 3 files changed, 91 insertions(+), 59 deletions(-) create mode 100644 system/boot.lua diff --git a/startup b/startup index ebe6e32..2e9e5ca 100644 --- a/startup +++ b/startup @@ -1,55 +1,2 @@ -- bits-UI: An operating system for ComputerCraft. Licensed with GPL-3.0. - -local version = "1.0 Alpha 1" -local desktop = "/system/desktop.lua" - -term.clear() -term.setCursorPos(1,1) -print("Starting up bits-UI ".. version .."...") -sleep(3) - -if term.isColor() then - print("[OK] Advanced Computer is detected...") -else - print("[ERROR] You need a advanced computer in order to make the UI functional...") - sleep(3) - os.shutdown() -end - -sleep(3) - -if fs.exists(desktop) then - print("[OK] Desktop has been found...") -else - print("[ERROR] Desktop cannot be found...") - sleep(3) - os.shutdown() -end - -sleep(3) - -if fs.exists("/home") then - print("[OK] Home has been found...") -else - fs.makeDir("/home") - print("[OK] Home directory has been created...") -end - -sleep(3) - -if fs.exists("/system/bitUI.config") then - print("[OK] Config has been found...") -else - config = io.open("/system/bitUI.config", "w") - config:close() - - print("[INFO] Config has not been found!") - print("[INFO] You will be sent to the OOBE setup...") -end - -sleep(3) - -print("[DONE] Boot sequence is completed...") - -sleep(3) -shell.run(desktop) \ No newline at end of file +shell.run("/system/boot.lua") \ No newline at end of file diff --git a/system/boot.lua b/system/boot.lua new file mode 100644 index 0000000..1afc489 --- /dev/null +++ b/system/boot.lua @@ -0,0 +1,63 @@ + +-- bits-UI: An operating system for ComputerCraft. Licensed with GPL-3.0. + +local version = "1.0 Alpha 1" +local desktop = "/system/desktop.lua" + +term.clear() +term.setCursorPos(1,1) + +print("Starting up bits-UI ".. version .."...") +sleep(3) + +if term.isColor() then + term.setTextColor(colors.green) + print("[OK] Advanced Computer is detected...") +else + print("[ERROR] You need a advanced computer in order to make the UI functional...") + sleep(3) + os.shutdown() +end + +sleep(3) + +if fs.exists(desktop) then + term.setTextColor(colors.green) + print("[OK] Desktop has been found...") +else + term.setTextColor(colors.red) + print("[ERROR] Desktop cannot be found...") + sleep(3) + os.shutdown() +end + +sleep(3) + +if fs.exists("/home") then + term.setTextColor(colors.green) + print("[OK] Home has been found...") +else + fs.makeDir("/home") + term.setTextColor(colors.green) + print("[OK] Home directory has been created...") +end + +sleep(3) + +if fs.exists("/system/bitUI.config") then + term.setTextColor(colors.green) + print("[OK] Config has been found...") +else + config = io.open("/system/bitUI.config", "w") + config:close() + term.setTextColor(colors.blue) + print("[INFO] Config has not been found!") + print("[INFO] You will be sent to the OOBE setup...") +end + +sleep(3) +term.setTextColor(colors.green) +print("[DONE] Boot sequence is completed...") + +sleep(3) +shell.run(desktop) \ No newline at end of file diff --git a/system/desktop.lua b/system/desktop.lua index 1e4a40d..83abc6f 100644 --- a/system/desktop.lua +++ b/system/desktop.lua @@ -1,5 +1,27 @@ -os.pullEvent = os.pullEventRaw -term.clear() -term.setCursorPos(1,1) -term.setBackgroundColor(colors.white) -print("Welcome to the desktop where nothing happens... Yet!") \ No newline at end of file +-- bits-UI: An operating system for ComputerCraft. Licensed with GPL-3.0. + +function titleBar() + local time = os.time() + local formattedTime = textutils.formatTime(time, false) + term.setCursorPos(1,1) + term.setBackgroundColor(colors.green) + term.setTextColor(1) + term.clearLine() + term.setCursorPos(2, 1) + print("[Apps]") + term.setCursorPos(44, 1) + print(formattedTime) + end + +function drawDesktop() + term.setBackgroundColor(colors.black) + term.clear() + titleBar() +end + +drawDesktop() + +while true do +local event, button, X, Y = os.pullEventRaw() +drawDesktop() +end \ No newline at end of file -- cgit v1.2.3