Advertisement
DOGGYWOOF

Untitled

Jan 14th, 2025 (edited)
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. -- Doggy OS UEFI with Animations and Transitions
  2.  
  3. -- Function to draw a border
  4. local function drawBorder()
  5. term.clear()
  6. local w, h = term.getSize()
  7. for y = 1, h do
  8. term.setCursorPos(1, y)
  9. term.write("|")
  10. term.setCursorPos(w, y)
  11. term.write("|")
  12. end
  13. for x = 1, w do
  14. term.setCursorPos(x, 1)
  15. term.write("-")
  16. term.setCursorPos(x, h)
  17. term.write("-")
  18. end
  19. term.setCursorPos(1, 1)
  20. term.write("+")
  21. term.setCursorPos(w, 1)
  22. term.write("+")
  23. term.setCursorPos(1, h)
  24. term.write("+")
  25. term.setCursorPos(w, h)
  26. term.write("+")
  27. end
  28.  
  29. -- Function to center text on the screen
  30. local function centerText(text, y)
  31. local w, _ = term.getSize()
  32. local x = math.floor((w - #text) / 2) + 1
  33. term.setCursorPos(x, y)
  34. term.write(text)
  35. end
  36.  
  37. -- Function to animate fading text
  38. local function fadeText(text, y, duration)
  39. local steps = 10
  40. local interval = duration / steps
  41. for i = 1, steps do
  42. term.setTextColor(colors.gray + i)
  43. centerText(text, y)
  44. sleep(interval)
  45. end
  46. term.setTextColor(colors.white) -- Reset text color
  47. end
  48.  
  49. -- Function to show a loading animation
  50. local function loadingAnimation(y)
  51. local w, _ = term.getSize()
  52. local x = math.floor(w / 2)
  53. local symbols = { "-", "\\", "|", "/" }
  54. for i = 1, 12 do -- Run for a few iterations
  55. term.setCursorPos(x, y)
  56. term.write(symbols[(i - 1) % #symbols + 1])
  57. sleep(0.1)
  58. end
  59. end
  60.  
  61. -- Function to show the UEFI message
  62. local function showUEFIMessage(message)
  63. drawBorder()
  64. local _, h = term.getSize()
  65. centerText("Doggy OS UEFI", math.floor(h / 2) - 1)
  66. fadeText(message, math.floor(h / 2) + 1, 1.5)
  67. end
  68.  
  69. -- Function to load the boot animation
  70. local function loadBootAnimation()
  71. if fs.exists("/disk/boot/boot-animation") then
  72. shell.run("/disk/boot/boot-animation")
  73. else
  74. print("Boot animation not found!")
  75. end
  76. end
  77.  
  78. -- Function to load the boot options
  79. local function loadBootOptions()
  80. if fs.exists("/disk/boot/boot-options") then
  81. shell.run("/disk/boot/boot-options")
  82. else
  83. print("Boot options not found!")
  84. end
  85. end
  86.  
  87. -- Main function to handle UEFI message and timeout
  88. local function main()
  89. showUEFIMessage("Press DEL to show startup options")
  90. loadingAnimation(math.floor(select(2, term.getSize()) / 2) + 2)
  91.  
  92. local timer = os.startTimer(2.5) -- Set a timer for 2 seconds
  93.  
  94. while true do
  95. local event, param = os.pullEvent()
  96. if event == "key" and param == keys.delete then
  97. -- Update message and load boot options
  98. showUEFIMessage("Loading startup menu...")
  99. sleep(1) -- Pause briefly for effect
  100. loadBootOptions()
  101. return
  102. elseif event == "timer" and param == timer then
  103. -- Timer expired, load boot animation
  104. loadBootAnimation()
  105. return
  106. end
  107. end
  108. end
  109.  
  110. -- Start the main function
  111. main()
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement