Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to draw a bordered box
- local function drawBorderedBox(x, y, width, height, borderColor, bgColor)
- paintutils.drawBox(x, y, x + width - 1, y + height - 1, borderColor)
- paintutils.drawFilledBox(x + 1, y + 1, x + width - 2, y + height - 2, bgColor)
- end
- -- Function to draw centered text
- local function drawCenteredText(y, text, textColor, bgColor)
- local w, h = term.getSize()
- local x = math.floor((w - #text) / 2) + 1
- term.setCursorPos(x, y)
- term.setTextColor(textColor)
- term.setBackgroundColor(bgColor)
- term.write(text)
- end
- -- Function to display the splash screen
- local function showSplashScreen()
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setCursorPos(1, 1)
- local screenWidth, screenHeight = term.getSize()
- -- Draw outer border and background
- drawBorderedBox(1, 1, screenWidth, screenHeight, colors.lightGray, colors.blue)
- -- Draw inner filled area
- paintutils.drawFilledBox(2, 2, screenWidth - 1, screenHeight - 1, colors.gray)
- -- Draw title bar
- drawBorderedBox(2, 2, screenWidth - 1, 3, colors.lightGray, colors.lightGray)
- -- Draw title text
- drawCenteredText(3, "Doggy OS", colors.blue, colors.lightGray)
- -- Draw loading message
- drawCenteredText(math.floor(screenHeight / 2), "Loading...", colors.black, colors.gray)
- -- Draw spinning wheel animation
- local spinnerFrames = {"|", "/", "-", "\\"}
- local spinnerX = math.floor(screenWidth / 2)
- local spinnerY = math.floor(screenHeight / 2) + 2
- local frameIndex = 1
- local function animateSpinner()
- while true do
- term.setCursorPos(spinnerX, spinnerY)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- term.write(spinnerFrames[frameIndex])
- frameIndex = frameIndex % #spinnerFrames + 1
- os.sleep(0.2) -- Adjust speed of animation here
- end
- end
- -- Start spinner animation in a separate thread
- parallel.waitForAny(animateSpinner)
- end
- -- Example usage: Display splash screen
- showSplashScreen()
- -- Simulate loading process (replace with actual boot code)
- os.sleep(5) -- Replace with actual initialization process
- -- Continue with normal boot process
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1, 1)
- print("No issues detected. Continuing boot process...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement