Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Minif OS Main Core
- osScreenSizeX, osScreenSizeY = term.getSize()
- function osFillBG(selColor)
- paintutils.drawFilledBox(1,1,osScreenSizeX,osScreenSizeY,selColor)
- term.setCursorPos(1,1)
- term.setBackgroundColor(selColor)
- if selColor == colors.white then
- term.setTextColor(colors.black)
- else
- term.setTextColor(colors.white)
- end
- end
- function osBSOD(message, cause, tips)
- osFillBG(colors.blue)
- print("Critical System Error!")
- print(message)
- print(cause)
- print(tips)
- print("")
- print("Press any key to continue.")
- sleep(2)
- local blank1, blank2 = os.pullEvent()
- end
- function osDrawWindow(name)
- paintutils.drawFilledBox(3,3,osScreenSizeX-2,osScreenSizeY-2,colors.white)
- paintutils.drawBox(3,3,osScreenSizeX-2,5,colors.lightGray)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(4,4)
- term.write(name)
- end
- function osConfirm(name,message,detail)
- osDrawWindow(name)
- term.setCursorPos(4,7)
- term.write(message)
- term.setCursorPos(4,8)
- term.write(detail)
- paintutils.drawBox(4,11,osScreenSizeX-3,11,colors.green)
- term.setCursorPos(5,11)
- term.write("Yes")
- paintutils.drawBox(4,13,osScreenSizeX-3,13,colors.red)
- term.setCursorPos(5,13)
- term.write("No")
- local choice = false
- while true do
- osPEvent, osPB, osPX, osPY = os.pullEvent("mouse_click")
- if osPX >= 3 and osPX <=osScreenSizeX-2 then
- if osPY == 11 then
- choice = true
- return true
- else if osPY == 13 then
- return false
- end
- end
- end
- end
- return choice
- end
- function osDrawPerm(prog)
- paintutils.drawFilledBox(3,3,osScreenSizeX-2,osScreenSizeY-2,colors.white)
- paintutils.drawBox(3,3,osScreenSizeX-2,5,colors.lightGray)
- term.setCursorPos(4,4)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- term.write("Permissions Error")
- term.setCursorPos(4,7)
- term.setTextColor(colors.black)
- term.write("You do not have permission")
- term.setCursorPos(4,8)
- term.write("To access the program: "..prog)
- term.setCursorPos(4,10)
- term.write("Press any key to exit.")
- while true do
- local event = os.pullEvent()
- if event == "mouse_click" or event == "key" then
- return
- end
- end
- end
- function osDrawDesktop()
- osFillBG(colors.cyan)
- if mos.osUserBGImageExists then
- paintutils.drawImage(os_UserBGImage,1,2)
- else
- if osBGImageExists then
- paintutils.drawImage(os_BGImage,1,1)
- end
- end
- end
- function osDrawMenu()
- paintutils.drawBox(1,1,mos.osScreenSizeX,1,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.black)
- term.setCursorPos(1,1)
- term.write("M >")
- term.setCursorPos(5,1)
- term.write("File >")
- term.setCursorPos(12,1)
- term.write("System >")
- end
- function osDrawAll()
- term.setCursorBlink(false)
- osLoadPrefs()
- osDrawDesktop()
- osDrawMenu()
- end
- function osLoadPrefs()
- local pref = fs.open("/system/user/"..mos.osEnteredUser.."/config", "r")
- local readFile = pref.readLine()
- if fs.exists(readFile) and not (fs.isDir(readFile)) then
- os_UserBGImage = paintutils.loadImage(readFile)
- mos.osUserBGImageExists = true
- end
- local readLine = pref.readLine()
- if readLine == "true" then
- mos.osUserAdmin = true
- end
- pref.close()
- end
Add Comment
Please, Sign In to add comment