Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- state = 0
- clear = function()
- term.clear()
- term.setCursorPos(1,1)
- end
- osInfo = function()
- term.setTextColor(colors.white)
- term.setCursorPos(43,1)
- print("CharlieOS")
- term.setCursorPos(43,2)
- print("dev1.0b")
- end
- drawDesktop = function()
- term.setBackgroundColor(colors.lightBlue)
- clear()
- osInfo()
- wp = fs.open("/system/settings/background","r")
- wpn = wp.readLine()
- bg = paintutils.loadImage("".. wpn)
- wp.close()
- paintutils.drawImage(bg, 1,1)
- paintutils.drawLine(1,19,51,19,colors.blue)
- term.setCursorPos(1,19)
- term.write("Start|")
- end
- drawStart = function()
- term.setCursorPos(1,17)
- term.setBackgroundColor(colors.lightGray)
- term.write(" |Programs >")
- term.setCursorPos(1,18)
- term.setBackgroundColor(colors.lightGray)
- term.write(" |Shutdown >")
- end
- drawSDM = function()
- term.setCursorPos(14,16)
- term.setBackgroundColor(colors.lightGray)
- term.write(" |Shutdown ")
- term.setCursorPos(14,17)
- term.setBackgroundColor(colors.lightGray)
- term.write(" |Logoff ")
- term.setCursorPos(14,18)
- term.setBackgroundColor(colors.lightGray)
- term.write(" |Reboot ")
- end
- drawPrograms = function()
- term.setCursorPos(14,15)
- term.setBackgroundColor(colors.lightGray)
- term.write(" |Edit Wallpaper")
- term.setCursorPos(14,16)
- term.setBackgroundColor(colors.lightGray)
- term.write(" |Settings ")
- term.setCursorPos(14,17)
- term.setBackgroundColor(colors.lightGray)
- term.write(" |Wallpapers ")
- end
- def = function()
- state = 0
- drawDesktop()
- startFunc()
- end
- startFunc = function()
- while state == 0 do
- e, button, x, y = os.pullEvent()
- if e == "mouse_up" then
- --Start Button
- if button == 1 and x >= 1 and x <= 5 and y == 19 then
- state = 1
- drawStart()
- else
- def()
- end
- end
- end
- while state == 1 do
- e, button, x, y = os.pullEvent()
- if e == "mouse_up" then
- --Shutdown
- if button == 1 and x >= 1 and x <= 13 and y == 18 then
- state = 2
- drawSDM()
- --Programs
- elseif button == 1 and x >= 1 and x <= 13 and y == 17 then
- state = 3
- drawPrograms()
- --Start Button (R)
- elseif button == 1 and x >= 1 and x <= 5 and y == 19 then
- state = 0
- drawDesktop()
- def()
- else
- def()
- end
- end
- end
- while state == 2 do
- e, button, x, y = os.pullEvent()
- if e == "mouse_up" then
- --Shutdown
- if button == 1 and x >= 14 and x <= 26 and y == 16 then
- os.shutdown()
- --Logoff
- elseif button == 1 and x >= 14 and x <= 26 and y == 17 then
- shell.run("/system/profile/login")
- --Reboot
- elseif button == 1 and x >= 14 and x <= 26 and y == 18 then
- os.reboot()
- --Shutdown (R)
- elseif button == 1 and x >= 1 and x <= 13 and y == 18 then
- state = 1
- drawDesktop()
- drawStart()
- --Start (R)
- elseif button == 1 and x >= 1 and x <= 5 and y == 19 then
- state = 0
- drawDesktop()
- def()
- --Programs
- elseif button == 1 and x >= 1 and x <= 13 and y == 17 then
- state = 3
- drawDesktop()
- drawStart()
- drawPrograms()
- else
- def()
- end
- end
- end
- while state == 3 do
- e, button, x, y = os.pullEvent()
- if e == "mouse_up" then
- --Wallpapers
- if button == 1 and x >= 14 and x <= 30 and y == 17 then
- drawDesktop()
- shell.run("/system/programs/wallpapers")
- --Settings
- elseif button == 1 and x >= 14 and x <= 30 and y == 16 then
- drawDesktop()
- shell.run("/system/programs/settings")
- --Edit Wallpaper
- elseif button == 1 and x >= 14 and x <= 30 and y == 15 then
- term.clear()
- shell.run("/system/programs/cpaint", "/system/res/backgrounds/custom")
- --Programs (R)
- elseif button == 1 and x >= 1 and x <= 13 and y == 17 then
- state = 1
- drawDesktop()
- drawStart()
- --Start (R)
- elseif button == 1 and x >= 1 and x <= 5 and y == 19 then
- state = 0
- drawDesktop()
- def()
- elseif button == 1 and x >= 1 and x <= 13 and y == 18 then
- state = 2
- drawDesktop()
- drawStart()
- drawSDM()
- else
- def()
- end
- end
- end
- end
- start = function()
- clear()
- drawDesktop()
- startFunc()
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement