Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Doggy OS UEFI with Animations and Transitions
- -- Function to draw a border
- local function drawBorder()
- term.clear()
- local w, h = term.getSize()
- for y = 1, h do
- term.setCursorPos(1, y)
- term.write("|")
- term.setCursorPos(w, y)
- term.write("|")
- end
- for x = 1, w do
- term.setCursorPos(x, 1)
- term.write("-")
- term.setCursorPos(x, h)
- term.write("-")
- end
- term.setCursorPos(1, 1)
- term.write("+")
- term.setCursorPos(w, 1)
- term.write("+")
- term.setCursorPos(1, h)
- term.write("+")
- term.setCursorPos(w, h)
- term.write("+")
- end
- -- Function to center text on the screen
- local function centerText(text, y)
- local w, _ = term.getSize()
- local x = math.floor((w - #text) / 2) + 1
- term.setCursorPos(x, y)
- term.write(text)
- end
- -- Function to animate fading text
- local function fadeText(text, y, duration)
- local steps = 10
- local interval = duration / steps
- for i = 1, steps do
- term.setTextColor(colors.gray + i)
- centerText(text, y)
- sleep(interval)
- end
- term.setTextColor(colors.white) -- Reset text color
- end
- -- Function to show a loading animation
- local function loadingAnimation(y)
- local w, _ = term.getSize()
- local x = math.floor(w / 2)
- local symbols = { "-", "\\", "|", "/" }
- for i = 1, 12 do -- Run for a few iterations
- term.setCursorPos(x, y)
- term.write(symbols[(i - 1) % #symbols + 1])
- sleep(0.1)
- end
- end
- -- Function to show the UEFI message
- local function showUEFIMessage(message)
- drawBorder()
- local _, h = term.getSize()
- centerText("Doggy OS UEFI", math.floor(h / 2) - 1)
- fadeText(message, math.floor(h / 2) + 1, 1.5)
- end
- -- Function to load the boot animation
- local function loadBootAnimation()
- if fs.exists("/disk/boot/boot-animation") then
- shell.run("/disk/boot/boot-animation")
- else
- print("Boot animation not found!")
- end
- end
- -- Function to load the boot options
- local function loadBootOptions()
- if fs.exists("/disk/boot/boot-options") then
- shell.run("/disk/boot/boot-options")
- else
- print("Boot options not found!")
- end
- end
- -- Main function to handle UEFI message and timeout
- local function main()
- showUEFIMessage("Press DEL to show startup options")
- loadingAnimation(math.floor(select(2, term.getSize()) / 2) + 2)
- local timer = os.startTimer(2.5) -- Set a timer for 2 seconds
- while true do
- local event, param = os.pullEvent()
- if event == "key" and param == keys.delete then
- -- Update message and load boot options
- showUEFIMessage("Loading startup menu...")
- sleep(1) -- Pause briefly for effect
- loadBootOptions()
- return
- elseif event == "timer" and param == timer then
- -- Timer expired, load boot animation
- loadBootAnimation()
- return
- end
- end
- end
- -- Start the main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement