Advertisement
DOGGYWOOF

DOGGY OS BOOT SCREEN

Jun 30th, 2024 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 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 with dog image and loading bar
  18. local function showSplashScreen()
  19. local bgColor = colors.gray -- Adjusted middle color around the dog image
  20.  
  21. term.setBackgroundColor(colors.blue)
  22. term.clear()
  23. term.setCursorPos(1, 1)
  24.  
  25. local screenWidth, screenHeight = term.getSize()
  26.  
  27. -- Draw outer border and background
  28. drawBorderedBox(1, 1, screenWidth, screenHeight, colors.lightGray, colors.blue)
  29.  
  30. -- Draw inner filled area
  31. paintutils.drawFilledBox(2, 2, screenWidth - 1, screenHeight - 1, colors.gray)
  32.  
  33. -- Draw title bar
  34. drawBorderedBox(2, 2, screenWidth - 1, 3, colors.lightGray, colors.lightGray)
  35.  
  36. -- Draw title text
  37. drawCenteredText(3, "Doggy OS", colors.blue, colors.lightGray)
  38.  
  39. -- Draw ASCII art dog image with adjusted background color
  40. local dogImage = {
  41. " |\\_/| ",
  42. " | @ @ Woof! ",
  43. " | <> _ ",
  44. " | _/\\------____ ((| |))",
  45. " | `--' | ",
  46. " _____|_ ___| |___.' ",
  47. "/_/_____/____/_______| "
  48. }
  49.  
  50. local dogX = math.floor(screenWidth / 2) - 11
  51. local dogY = math.floor(screenHeight / 2) - 5 -- Adjusted position for the dog image
  52.  
  53. term.setTextColor(colors.yellow)
  54. for i, line in ipairs(dogImage) do
  55. term.setCursorPos(dogX, dogY + i)
  56. term.setBackgroundColor(bgColor) -- Set background color around the dog image
  57. term.write(line)
  58. end
  59.  
  60. -- Loading bar parameters
  61. local barWidth = 30
  62. local barHeight = 1 -- Height of the loading bar
  63. local barX = math.floor((screenWidth - barWidth) / 2)
  64. local barY = math.floor(screenHeight / 2) + 6 -- Adjusted position for the loading bar
  65.  
  66. -- Draw box around loading bar with a different border color
  67. drawBorderedBox(barX - 1, barY - 1, barWidth + 2, barHeight + 2, colors.blue, colors.gray)
  68.  
  69. -- Function to update loading bar (original speed)
  70. local function updateLoadingBar(progress)
  71. local fillWidth = math.floor(barWidth * progress)
  72. term.setCursorPos(barX, barY)
  73. term.setBackgroundColor(colors.lightGray)
  74. term.write(string.rep(" ", fillWidth))
  75. term.setBackgroundColor(colors.gray)
  76. term.write(string.rep(" ", barWidth - fillWidth))
  77. end
  78.  
  79. -- Simulate loading process (original speed)
  80. local totalSteps = 20 -- Total steps for loading animation
  81. for i = 1, totalSteps do
  82. local progress = i / totalSteps
  83. updateLoadingBar(progress)
  84. os.sleep(0.2) -- Original speed for loading animation
  85. end
  86.  
  87. -- Run /disk/os/lock.lua after loading completes
  88. shell.run("/disk/os/lock.lua")
  89.  
  90. -- Continue with normal boot process
  91. term.setBackgroundColor(colors.black)
  92. term.setTextColor(colors.white)
  93. term.clear()
  94. term.setCursorPos(1, 1)
  95. print("No issues detected. Continuing boot process...")
  96. end
  97.  
  98. -- Example usage: Display splash screen
  99. showSplashScreen()
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement