Advertisement
DOGGYWOOF

BIOS SPLASH SCREEN FOR CC

Jun 30th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. -- Function to draw a filled rectangle
  2. local function drawFilledRectangle(x, y, width, height, color)
  3. paintutils.drawFilledBox(x, y, x + width - 1, y + height - 1, color)
  4. end
  5.  
  6. -- Function to draw centered text
  7. local function drawCenteredText(y, text, textColor, bgColor)
  8. local w, h = term.getSize()
  9. local x = math.floor((w - #text) / 2) + 1
  10. term.setCursorPos(x, y)
  11. term.setTextColor(textColor)
  12. term.setBackgroundColor(bgColor)
  13. term.write(text)
  14. end
  15.  
  16. -- Function to display the splash screen
  17. local function showSplashScreen()
  18. term.clear()
  19. term.setCursorPos(1, 1)
  20.  
  21. local screenWidth, screenHeight = term.getSize()
  22.  
  23. -- Draw border
  24. drawFilledRectangle(1, 1, screenWidth, screenHeight, colors.blue)
  25. term.setTextColor(colors.white)
  26. term.setBackgroundColor(colors.blue)
  27.  
  28. -- Draw title
  29. drawCenteredText(math.floor(screenHeight / 2) - 4, "Doggy OS", colors.red, colors.blue)
  30.  
  31. -- Draw message
  32. drawCenteredText(math.floor(screenHeight / 2) - 2, "Loading...", colors.black, colors.blue)
  33.  
  34. -- Draw spinning wheel animation
  35. local spinnerFrames = {"|", "/", "-", "\\"}
  36. local spinnerX = math.floor(screenWidth / 2)
  37. local spinnerY = math.floor(screenHeight / 2) + 2
  38. local frameIndex = 1
  39.  
  40. local function animateSpinner()
  41. while true do
  42. term.setCursorPos(spinnerX, spinnerY)
  43. term.write(spinnerFrames[frameIndex])
  44. frameIndex = frameIndex % #spinnerFrames + 1
  45. os.sleep(0.2) -- Adjust speed of animation here
  46. end
  47. end
  48.  
  49. -- Start spinner animation in a separate thread
  50. parallel.waitForAny(animateSpinner)
  51. end
  52.  
  53. -- Example usage: Display splash screen
  54. showSplashScreen()
  55.  
  56. -- Simulate loading process (replace with actual boot code)
  57. os.sleep(5) -- Replace with actual initialization process
  58.  
  59. -- Continue with normal boot process
  60. term.clear()
  61. term.setCursorPos(1, 1)
  62. print("No issues detected. Continuing boot process...")
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement