Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --desktop
- slc = 0
- tBarC = 128
- tBaTC = 1
- backColor = 8
- term.setBackgroundColor(backColor)
- term.clear()
- function titleBar()
- term.setCursorPos(1,1)
- term.setBackgroundColor(tBarC)
- term.setTextColor(tBaTC)
- term.clearLine()
- term.setCursorPos(2,1)
- print("[System]")
- term.setCursorPos(11,1)
- print("[Programs]")
- end
- function drawDesktop()
- term.setBackgroundColor(backColor)
- term.clear()
- bground = paintutils.loadImage(".background")
- if bground == nil then
- paintutils.drawPixel(15,10,16384)
- paintutils.drawPixel(16,10,16384)
- paintutils.drawPixel(17,10,16384)
- paintutils.drawPixel(15,11,16384)
- paintutils.drawPixel(15,12,16384)
- paintutils.drawPixel(15,13,16384)
- paintutils.drawPixel(15,14,16384)
- paintutils.drawPixel(16,14,16384)
- paintutils.drawPixel(17,14,16384)
- paintutils.drawPixel(18,14,16384)
- paintutils.drawPixel(19,14,16384)
- paintutils.drawPixel(19,13,16384)
- paintutils.drawPixel(22,10,512)
- paintutils.drawPixel(22,12,512)
- paintutils.drawPixel(22,11,512)
- paintutils.drawPixel(22,13,512)
- paintutils.drawPixel(22,14,512)
- paintutils.drawPixel(23,10,512)
- paintutils.drawPixel(24,10,512)
- paintutils.drawPixel(25,10,512)
- paintutils.drawPixel(23,14,512)
- paintutils.drawPixel(24,14,512)
- paintutils.drawPixel(25,14,512)
- paintutils.drawPixel(28,10,2)
- paintutils.drawPixel(28,11,2)
- paintutils.drawPixel(28,12,2)
- paintutils.drawPixel(28,13,2)
- paintutils.drawPixel(28,14,2)
- paintutils.drawPixel(29,10,2)
- paintutils.drawPixel(30,10,2)
- paintutils.drawPixel(30,11,2)
- paintutils.drawPixel(30,12,2)
- paintutils.drawPixel(30,13,2)
- paintutils.drawPixel(30,14,2)
- paintutils.drawPixel(29,14,2)
- paintutils.drawPixel(28,14,2)
- paintutils.drawPixel(33,10,2)
- paintutils.drawPixel(33,11,2)
- paintutils.drawPixel(34,10,2)
- paintutils.drawPixel(34,12,2)
- paintutils.drawPixel(34,13,2)
- paintutils.drawPixel(33,14,2)
- paintutils.drawPixel(34,14,2)
- else
- paintutils.drawImage(bground,2,2)
- end
- titleBar()
- end
- function drawMenu1()
- term.setTextColor(256)
- term.setBackgroundColor(128)
- term.setCursorPos(1,2)
- print(" ")
- term.setCursorPos(1,3)
- print(" Shutdown ")
- term.setCursorPos(1,4)
- print(" Restart ")
- term.setCursorPos(1,5)
- print(" ")
- end
- function drawMenu2()
- term.setTextColor(256)
- term.setBackgroundColor(128)
- term.setCursorPos(11,2)
- print(" ")
- term.setCursorPos(11,3)
- print(" Paint ")
- term.setCursorPos(11,4)
- print(" ")
- end
- function drawPaintMenu()
- term.setTextColor(256)
- term.setBackgroundColor(128)
- term.setCursorPos(10,10)
- print(" ")
- term.setCursorPos(10,11)
- print("File Name: ")
- term.setCursorPos(10,12)
- print(" ")
- end
- drawDesktop()
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if slc == 0 then
- if event == "mouse_click" then
- if X >=1 and X <=10 and Y == 1 and button == 1 then --Clicking the System
- drawMenu1()
- slc = 1
- elseif X >=11 and X <=20 and Y == 1 and button == 1 then --Clicking on Programs
- drawMenu2()
- slc = 2
- else
- drawDesktop()
- end
- end
- elseif slc == 1 then
- if X >=1 and X<=11 and button == 1 and Y == 3 then slc = 0
- os.shutdown()
- elseif X>=1 and X<=11 and Y==4 and button == 1 then slc = 0
- os.reboot()
- else
- slc = 0
- drawDesktop()
- end
- elseif slc == 2 then
- if X >=11 and X<=15 and button == 1 and Y == 3 then slc = 0
- drawPaintMenu()
- slc = 3
- else
- slc = 0
- drawDesktop()
- end
- elseif slc == 3 then
- term.setCursorPos(10,11)
- term.setTextColor(2)
- local input = read("")
- if input ~= nil
- shell.paint(input)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement