Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Desktop
- os.loadAPI("fLib")
- slc = 0
- tBarC = 8 --Background color
- tBartC = 1 --Text color
- backColor = 1
- term.setBackgroundColor(backColor)
- term.clear()
- contextX = 0
- contextY = 0
- iCon1T="Test"
- iCon1="icon1"
- iConL1="Licon1"
- --name
- --image
- --program
- function time()
- term.setCursorPos(25,1)
- local t = os.time()
- print("Time: "..textutils.formatTime(t,false))
- sleep(1)
- end
- function titleBar()
- term.setCursorPos(1,1)
- term.setBackgroundColor(tBarC)
- term.setTextColor(tBartC)
- term.clearLine()
- term.setCursorPos(3, 1)
- print("[Begin]")
- end
- function drawDesktop()
- term.setBackgroundColor(backColor)
- term.clear()
- bground = paintutils.loadImage(".background")
- paintutils.drawImage(bground,1,1) --Move to Config
- icon1 = paintutils.loadImage(iCon1)
- paintutils.drawImage(icon1, 2, 3)
- term.setBackgroundColor(backColor)
- term.setCursorPos(1,7)
- term.setTextColor(colors.red)
- print("+")
- term.setTextColor(128)
- term.setCursorPos(2,8)
- print(iCon1T)
- 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.setBackgroundColor(128)
- term.setTextColor(256)
- term.setCursorPos(contextX, contextY)
- print(" ")
- term.setCursorPos(contextX, contextY + 1)
- print(" edit GUI ")
- term.setCursorPos(contextX, contextY+2)
- print(" FileManager ")
- term.setCursorPos(contextX, contextY+3)
- print(" ")
- end
- function drawMenu3(iX, iY)
- term.setBackgroundColor(128)
- term.setTextColor(256)
- term.setCursorPos(iX, iY)
- print(" ")
- term.setCursorPos(iX, iY+1)
- print(" Rename ")
- term.setCursorPos(iX, iY+2)
- print(" Ch-Icon ")
- term.setCursorPos(iX, iY+3)
- print(" Re-Link ")
- term.setCursorPos(iX, iY+4)
- print(" ")
- end
- drawDesktop()
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if slc == 0 then
- 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 <=5 and Y>=3 and Y<=9 and button == 1 then
- shell.run(iConL1) --1st icon that can be ran
- elseif X >= 1 and Y >= 2 and button == 2 then slc = 2
- if X >= 38 and Y >= 14 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()
- elseif X ==1 and Y ==7 and button ==1 then slc = 3
- drawMenu3(1,9)
- else
- drawDesktop()
- end
- end
- elseif slc == 1 then
- if X >=1 and X <=11 and button == 1 and Y== 3 then slc = 1
- 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 >= contextX and X <= contextX+13 and Y==contextY+1 and button == 1 then slc = 0
- shell.run("edit","gui")
- drawDesktop()
- elseif X>= contextX and X <=contextX+13 and Y==contextY+2 and button == 1 then slc = 0
- shell.run(iConL1)
- drawDesktop()
- else slc = 0
- drawDesktop()
- end
- elseif slc == 3 then
- if X >=1 and X <=10 and Y == 10 and button ==1 then
- term.setTextColor(256)
- term.setBackgroundColor(backColor)
- term.setCursorPos(2,8)
- print(" ")
- term.setCursorPos(2,8)
- input = read()
- fLib.replaceLine("gui",12,'iCon1T="'..tostring(input)..'"')
- return
- shell.run("gui")
- elseif X >= 1 and X <= 10 and Y == 11 and button == 1 then
- term.setBackgroundColor(128)
- lY = 8
- for i = 1,3 do
- term.setCursorPos(18, lY)
- print(" ")
- lY = lY+1
- end
- term.setBackgroundColor(256)
- term.setTextColor(1)
- term.setCursorPos(19, 9)
- print(" ")
- term.setCursorPos(20,9)
- input = read()
- fLib.replaceLine("gui",13,'iCon1="'..tostring(input)..'"')
- return
- shell.run("gui")
- elseif X >=1 and X <= 10 and Y==12 and button == 1 then
- term.setBackgroundColor(128)
- lY = 8
- for i =1,3 do
- term.setCursorPos(18,lY)
- print(" ")
- lY = lY+1
- end
- term.setBackgroundColor(256)
- term.setCursorPos(19,9)
- print(" ")
- term.setCursorPos(20,9)
- term.setTextColor(1)
- input = read()
- fLib.replaceLine("gui",14,'iConL1="'..tostring(input)..'"')
- return
- shell.run("gui")
- else
- slc = 0
- drawDesktop()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment