Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- startup.lua
- -- Function to clear the screen and set the background color
- local function clearScreen()
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- -- Function to center and draw the ASCII art, additional text, and spinning wheel
- local function drawCenteredAsciiArtAndText()
- local artLines = {
- " _____^_",
- " | | \\",
- " \\ / ^ |",
- " / \\_/ 0 \\",
- " / \\",
- " / ____ 0",
- "/ / \\___ _/"
- }
- local additionalText = "Doggy OS Pocket"
- local screenWidth, screenHeight = term.getSize()
- local artWidth = 0
- local artHeight = #artLines
- -- Calculate the width of the widest line in the ASCII art
- for _, line in ipairs(artLines) do
- artWidth = math.max(artWidth, #line)
- end
- -- Calculate the width of the additional text
- local textWidth = #additionalText
- -- Calculate starting positions
- local startX = math.floor((screenWidth - artWidth) / 2) + 1
- local startY = math.floor((screenHeight - artHeight - 2 - 2) / 2) + 1 -- -2 for art height and spacing, -2 for additional text and spacing
- -- Draw ASCII art
- for i, line in ipairs(artLines) do
- term.setCursorPos(startX, startY + i - 1)
- term.setTextColor(colors.yellow)
- print(line)
- end
- -- Draw additional text below ASCII art with 1 line spacing
- local textX = math.floor((screenWidth - textWidth) / 2) + 1
- local textY = startY + artHeight + 1 -- 1 line spacing
- term.setCursorPos(textX, textY)
- term.setTextColor(colors.white)
- print(additionalText)
- -- Draw spinning wheel below additional text with 1 line spacing
- local wheelX = math.floor(screenWidth / 2) + 1
- local wheelY = textY + 1 -- 1 line spacing
- local wheelStates = {"|", "/", "-", "\\"}
- local wheelIndex = 1
- while true do
- term.setCursorPos(wheelX, wheelY)
- term.setTextColor(colors.white)
- print(wheelStates[wheelIndex])
- -- Update the wheel index
- wheelIndex = (wheelIndex % #wheelStates) + 1
- -- Delay for animation effect
- os.sleep(0.1) -- Adjust the speed of the spinning wheel here
- -- Clear the previous wheel position (optional)
- term.setCursorPos(wheelX, wheelY)
- term.setTextColor(colors.black)
- print(" ")
- end
- end
- -- Main program
- clearScreen()
- drawCenteredAsciiArtAndText()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement