Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to draw a filled rectangle
- local function drawFilledRectangle(x, y, width, height, color)
- paintutils.drawFilledBox(x, y, x + width - 1, y + height - 1, color)
- 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.clear()
- term.setCursorPos(1, 1)
- local screenWidth, screenHeight = term.getSize()
- -- Draw border
- drawFilledRectangle(1, 1, screenWidth, screenHeight, colors.blue)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.blue)
- -- Draw title
- drawCenteredText(math.floor(screenHeight / 2) - 4, "Doggy OS", colors.red, colors.blue)
- -- Draw message
- drawCenteredText(math.floor(screenHeight / 2) - 2, "Loading...", colors.black, colors.blue)
- -- 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.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.clear()
- term.setCursorPos(1, 1)
- print("No issues detected. Continuing boot process...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement