Advertisement
DOGGYWOOF

Untitled

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