Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---- By: Goodle
- -- Variables
- width, height = term.getSize()
- CnWidth = width / 2
- CnHeight = height / 2
- time = os.time()
- formattedTime = textutils.formatTime( time, false)
- isMenu = false
- isDesktop = false
- isStartup = false
- -- Functions
- function time()
- return textutils.formatTime(os.time(), true)
- end
- startup = function()
- isStartup = true
- term.clear()
- term.setCursorPos(CnWidth-5,height-1)
- term.setTextColour( colours.blue )
- term.write("WaffgoOS by")
- term.setCursorPos(CnWidth-20,height)
- term.write("Goodle Software - In cooperation with CPGGC")
- term.setCursorPos(CnWidth-3,CnHeight-1)
- term.setTextColour( colours.lightBlue )
- term.write("Loading")
- term.setCursorPos(CnWidth-6,CnHeight)
- term.write(";")
- term.setCursorPos(CnWidth+6,CnHeight)
- term.write(";")
- term.setBackgroundColour( colours.black )
- term.setCursorPos(CnWidth,CnHeight+1)
- term.write('0%')
- sleep(1)
- paintutils.drawLine(CnWidth-5,CnHeight, CnWidth,CnHeight, colours.green )
- term.setBackgroundColour( colours.black )
- term.setCursorPos(CnWidth-1,CnHeight+1)
- term.write("50%")
- sleep(0.5)
- paintutils.drawLine(CnWidth,CnHeight, CnWidth+4,CnHeight, colours.green )
- term.setBackgroundColour( colours.black )
- term.setCursorPos(CnWidth-1,CnHeight+1)
- term.clearLine()
- term.write("78%")
- sleep(0.3)
- term.setCursorPos(CnWidth-1,CnHeight+1)
- term.clearLine()
- term.write("80%")
- sleep(0.5)
- paintutils.drawLine(CnWidth+4,CnHeight, CnWidth+5,CnHeight, colours.green )
- term.setBackgroundColour( colours.black )
- term.setCursorPos(CnWidth-1,CnHeight+1)
- term.clearLine()
- term.write("100%")
- term.setCursorPos(CnWidth-3,CnHeight-1)
- term.clearLine()
- term.setBackgroundColour( colours.black )
- term.write("Welcome!")
- sleep(3)
- isStartup = false
- desktop()
- end
- desktop = function()
- isDesktop = true
- term.clear()
- pixelsDown = 1
- pixelsDownLimit = height
- -- Desktop drawing
- while pixelsDown ~= height
- do paintutils.drawLine(1,pixelsDown, width,pixelsDown, colours.white )
- pixelsDown = pixelsDown + 1
- end
- paintutils.drawLine(1,height, width,height, colours.blue )
- term.setCursorPos(1,height)
- term.setTextColour( colours.white )
- term.setBackgroundColour( colours.lime )
- term.write(' @ menu ')
- -- Clock Drawing
- term.setCursorPos(width-6,height)
- term.setTextColour( colours.white )
- term.setBackgroundColour( colours.blue )
- local mon = window.create(term.current(),width-6,height,width,height)
- local ok, err = pcall( function()
- parallel.waitForAny(
- function()
- while true do
- mon.clear()
- mon.setCursorPos(2,3)
- mon.write(time())
- sleep(1)
- end
- end,
- function()
- os.run( {}, "desktop" )
- end
- )
- end )
- while isDesktop == true do
- term.setBackgroundColour( colours.white )
- term.setCursorPos(0,0)
- term.setCursorBlink(false)
- local event, click, x, y = os.pullEvent("mouse_click")
- if x == 2 then
- if y == height then
- break
- end
- end
- end
- end
- drawWindow = function()
- term.clear()
- end
- drawMenu = function()
- isMenu = true
- local menuPD = 2 -- Menu pixels down
- local menuPDL = height-1 -- Menu pixels down limit
- local menuPUL = height-10 -- Menu pixels up limit
- -- Menu pixels right limit is = 15
- while menuPD < menuPDL do
- paintutils.drawLine(1, menuPUL, 15, menuPUL, 400 )
- menuPUL = menuPUL + 1
- menuPD = menuPD + 1
- end -- Dimensions of menu: w-15 from left, h-9 from height - 1
- term.setCursorPos(1,height)
- term.setTextColour( colours.white )
- term.setBackgroundColour( colours.green )
- term.write(" @ menu ")
- paintutils.drawLine(9,height, 15,height, colours.blue )
- term.setCursorPos(2,height-1)
- term.setBackgroundColour( 400 )
- term.setTextColour( colours.yellow )
- term.write("@ Exit") -- Logoff button
- term.setCursorPos(2,height-2)
- term.setTextColour( colours.red )
- term.write("@ Shutdown") -- Shutdown button
- term.setCursorPos(2,height-3)
- term.setTextColour( colours.green )
- term.write("@ TMNET") -- Shutdown button
- term.setBackgroundColour( colours.white )
- while isMenu == true do
- local event, click2, x, y = os.pullEvent("mouse_click")
- if x == 2 and y == height then
- isMenu = false
- desktop()
- break
- end
- if x == 2 then
- if y == height-1 then
- isMenu = false
- isStartup = false
- isDesktop = false
- exit()
- end
- end
- if x == 2 then
- if y == height-2 then
- os.shutdown()
- end
- end
- if x == 2 then
- if y == height-3 then
- shell.run("web")
- isMenu = false
- desktop()
- break
- end
- end
- end
- end
- exit = function()
- term.clear()
- term.setBackgroundColour(colours.black)
- term.setTextColour(colours.white)
- term.setCursorPos(1,1)
- term.clear()
- end
- -- Program execution
- startup()
- drawMenu()
- while isDesktop == true do
- drawMenu()
- end
Advertisement
Add Comment
Please, Sign In to add comment