Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --PaulOS
- --Config
- slc = 0
- bC = 8
- tC = 1
- backColor = 1
- term.setBackgroundColor(backColor)
- term.clear()
- contextX = 0
- contextY = 0
- --Title Bar
- function titleBar()
- term.setCursorPos(1,1)
- term.setBackgroundColor(bC)
- term.setTextColor(tC)
- term.clearLine()
- term.setCursorPos(3, 1)
- print("[PaulOS]")
- end
- --Desktop
- function drawDesktop()
- local termW, termH = term.getSize()
- local termWh = termW / termW
- local termHh = termH / termH
- local logoX = termW - (termWh + 30)
- local logoY = termH - (termHh + 5)
- term.setBackgroundColor(backColor)
- term.clear()
- logo = paintutils.loadImage("/paulos/resources/logo")
- paintutils.drawImage(logo,logoX,logoY)
- icon = paintutils.loadImage("/paulos/resources/icon")
- paintutils.drawImage(icon, 2, 4)
- term.setBackgroundColor(backColor)
- term.setTextColor(128)
- term.setCursorPos(2,9)
- print("Games")
- icon2 = paintutils.loadImage("/paulos/resources/icon2")
- paintutils.drawImage(icon2, 2, 11)
- term.setCursorPos(2,19)
- print("Lemon")
- titleBar()
- end
- --Menu 1
- function drawMenu1()
- term.setTextColor(tC)
- term.setBackgroundColor(bC)
- term.setCursorPos(1,2)
- print(" ")
- term.setCursorPos(1,3)
- print(" Restart ")
- term.setCursorPos(1,4)
- print(" Shutdown ")
- term.setCursorPos(1,5)
- print(" Edit GUI ")
- term.setCursorPos(1,6)
- print(" CraftOS ")
- term.setCursorPos(1,7)
- print(" ")
- end
- --Menu 2
- function drawMenu2()
- term.setBackgroundColor(128)
- term.setCursorPos(contextX, contextY)
- print(" ")
- term.setCursorPos(contextX, contextY+1)
- print(" Reboot ")
- term.setCursorPos(contextX, contextY+2)
- print(" Shutdown ")
- term.setCursorPos(contextX, contextY+3)
- print(" ")
- end
- --Clock
- function Clock()
- term.setCursorPos(40,1)
- time = os.time()
- print(textutils.formatTime(time, true))
- time = os.time()
- if time + 0.05 < 23.99 then
- os.setAlarm(os.time() + 0.05)
- else
- titleBar()
- os.setAlarm(0)
- end
- end
- --Function call
- drawDesktop()
- Clock()
- --Listener
- local repeatw = true
- while repeatw==true do
- local event, button, X, Y = os.pullEventRaw()
- if slc == 0 then
- if event == "alarm" then
- Clock()
- end
- if event == "mouse_click" then
- if X >=2 and X <=8 and Y==1 and button ==1 then
- drawMenu1()
- slc = 1
- elseif X >=2 and X<=11 and Y>=3 and Y<=9 and button == 1 then
- shell.run("/paulos/apps/games")
- shell.run('clear')
- drawDesktop()
- elseif X >=2 and X <=8 and Y>=11 and Y<=19 and button == 1 then
- shell.run("/paulos/apps/filebrowser")
- shell.run('clear')
- drawDesktop()
- elseif X >= 1 and Y >=2 and button == 2 then slc = 2
- if X >=38 then
- contextX = 38
- end
- if Y >=14 then
- contextY = 14
- end
- if X <= 38 then
- contextX = X
- end
- if Y <= 14 then
- contextY = Y
- end
- drawMenu2()
- else
- drawDesktop()
- end
- end
- elseif slc == 1 then
- if X >=1 and X <=11 and button == 1 and Y== 3 then slc = 0
- os.reboot()
- elseif X>=1 and X<=11 and Y==4 and button ==1 then slc = 0
- os.shutdown()
- elseif X>=1 and X<=11 and Y==5 and button ==1 then slc = 0
- shell.run('edit gui')
- shell.run('clear')
- drawDesktop()
- elseif X>=1 and X<=11 and Y==6 and button ==1 then slc = 0
- repeatw = false
- else
- slc = 0
- drawDesktop()
- end
- elseif slc == 2 then
- if X >= contextX and X <= contextX+13 and Y==contextY+1 and button == 1 then slc = 0
- os.reboot()
- drawDesktop()
- elseif X>= contextX and X <=contextX+13 and Y==contextY+2 and button == 1 then slc = 0
- os.shutdown()
- drawDesktop()
- else slc = 0
- drawDesktop()
- end
- end
- end
- shell.run('clear')
- print("CraftOS")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement