Advertisement
DOGGYWOOF

Shutdown screen

Jun 30th, 2024 (edited)
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. function drawCenteredText(y, text)
  2. local w, _ = term.getSize()
  3. local x = math.floor((w - #text) / 2)
  4. term.setCursorPos(x, y)
  5. term.write(text)
  6. end
  7.  
  8. function drawShutdownScreen()
  9. term.setBackgroundColor(colors.black)
  10. term.clear()
  11. term.setTextColor(colors.white)
  12.  
  13. local _, h = term.getSize()
  14.  
  15. -- Draw Windows-like shutdown interface
  16. term.setBackgroundColor(colors.blue)
  17. term.clear()
  18. term.setCursorPos(1, 1)
  19. term.setTextColor(colors.white)
  20. drawCenteredText(3, "Doggy OS")
  21.  
  22. term.setCursorPos(1, h - 5)
  23. term.setTextColor(colors.lightGray)
  24. drawCenteredText(h - 4, "Shutting down...")
  25.  
  26. term.setCursorPos(1, h - 3)
  27. drawCenteredText(h - 2, "Thank you for using Doggy OS!")
  28.  
  29. os.sleep(3) -- Display the shutdown screen for 3 seconds
  30.  
  31. term.setBackgroundColor(colors.black)
  32. term.clear()
  33. term.setTextColor(colors.white)
  34.  
  35. drawCenteredText(math.floor(h / 2), "Goodbye!")
  36.  
  37. os.sleep(2) -- Pause for 2 seconds before shutting down
  38.  
  39. os.shutdown()
  40. end
  41.  
  42. -- Main script execution starts here
  43. drawShutdownScreen()
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement