Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local w,h = term.getSize()
- slc = 0
- tBarC = 8
- tBartC = colors.white
- backColor = 1
- isBuild = false
- term.setBackgroundColor(backColor)
- term.clear()
- function time()
- local time = os.time()
- local fTime = textutils.formatTime(time, false)
- term.setCursorPos(w - 7, h)
- term.setBackgroundColor(tBarC)
- term.setTextColor(tBartC)
- write(fTime)
- end
- function titleBar()
- term.setCursorPos(1,h)
- term.setBackgroundColor(tBarC)
- term.setTextColor(tBartC)
- term.clearLine()
- term.setTextColor(tBartC)
- term.setCursorPos(1, h)
- write(" Menu ")
- term.setCursorPos(w - 5, h)
- end
- function titleBarMenuClick()
- term.setCursorPos(1,h)
- term.setBackgroundColor(tBarC)
- term.setTextColor(tBartC)
- term.clearLine()
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1, h)
- write(" Menu ")
- end
- function drawDesktop()
- term.setBackgroundColor(backColor)
- term.clear()
- bground = paintutils.loadImage("m-os/images/bground")
- paintutils.drawImage(bground,w/2-51/2,h/2-19/2)
- titleBar()
- if isBuild == true then
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lightGray)
- term.setCursorPos(w-27,h-2)
- print("M-OS 1.1.1 Deveolper Preview")
- term.setCursorPos(w-27,h-1)
- print("build-4, build date: 4/27/17")
- end
- end
- function drawMenu1()
- term.setTextColor(tBartC)
- term.setBackgroundColor(tBarC)
- term.setCursorPos(1,h - 9)
- print(" ")
- term.setCursorPos(1,h - 8)
- print(" Settings ")
- term.setCursorPos(1,h - 7)
- print(" Programs ")
- term.setCursorPos(1,h - 6)
- print(" ")
- term.setCursorPos(1,h - 5)
- print(" Logoff ")
- term.setCursorPos(1,h - 4)
- print(" ")
- term.setCursorPos(1, h - 3)
- print(" Shutdown ")
- term.setCursorPos(1, h - 2)
- print(" Restart ")
- term.setCursorPos(1, h - 1)
- print(" ")
- end
- drawDesktop()
- while true do
- local event, button, X, Y = os.pullEvent()
- if event == "mouse_click" then
- if X >=2 and X <=6 and Y==h and button ==1 and slc == 0 then
- drawMenu1()
- titleBarMenuClick()
- slc = 1
- sleep(0.2)
- canClick = true
- elseif X>=1 and X<=6 and Y==h and button == 1 and slc == 1 and canClick == true then
- drawDesktop()
- slc = 0
- elseif X>=1 and X<=11 and Y==h - 7 and slc == 1 and button == 1 then
- shell.run("m-os/programs/installed_programs")
- elseif X>=1 and X<=11 and Y==h-8 and slc == 1 and button == 1 then
- shell.run("m-os/settings")
- elseif X>=1 and X<=11 and Y==h-5 and slc == 1 and button == 1 then
- shell.run("m-os/logon")
- elseif X>=1 and X<=11 and Y==h - 2 and slc == 1 and button == 1 then
- os.reboot()
- elseif X>=1 and X<=11 and Y==h - 3 and slc == 1 and button == 1 then
- os.shutdown()
- end
- end
- end
- local w,h = term.getSize()
- local ok, err = pcall(main)
- if not ok then
- term.setBackgroundColor(colors.red)
- term.clear()
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1,1)
- term.clearLine()
- term.setTextColor(colors.white)
- print("Internal System Error")
- term.setBackgroundColor(colors.red)
- print("The following error has occured: " .. err)
- print("Please report this error to MarcoPolo0306. (=")
- print("(Your computer will restart in 15 seconds.)")
- sleep(15)
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement