Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Doggy OS Shutdown Screen with Spinner
- local w, h = term.getSize()
- -- Function to center text horizontally
- local function centerText(y, text)
- local x = math.floor((w - #text) / 2)
- term.setCursorPos(x, y)
- term.write(text)
- end
- -- Function to draw the spinner animation
- local function drawSpinner(x, y, delay)
- local spinnerFrames = {"|", "/", "-", "\\"}
- local frameCount = #spinnerFrames
- local currentFrame = 1
- while true do
- term.setCursorPos(x, y)
- term.write(spinnerFrames[currentFrame])
- currentFrame = currentFrame % frameCount + 1
- os.sleep(delay)
- end
- end
- -- Function to draw the shutdown screen
- local function drawShutdownScreen()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setTextColor(colors.white)
- centerText(math.floor(h / 2), "Doggy OS is shutting down...")
- -- Start spinner animation
- local spinnerX = math.floor(w / 2) - 1
- local spinnerY = math.floor(h / 2) + 2
- drawSpinner(spinnerX, spinnerY, 0.1)
- end
- -- Main program
- drawShutdownScreen()
- -- Simulate shutdown process (this is where you'd place your shutdown logic)
- print("Shutting down Doggy OS...")
- os.sleep(3) -- Simulate shutdown process
- -- Clear screen after shutdown
- term.setBackgroundColor(colors.black)
- term.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement