JFrameXI

startupScreen

Nov 12th, 2025 (edited)
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. local mon = peripheral.wrap("monitor_8")
  2. mon.setTextScale(0.5)
  3. mon.clear()
  4. mon.setBackgroundColor(colors.black)
  5.  
  6. local w, h = mon.getSize()
  7.  
  8. -- McDonald's ASCII logo
  9. local logo = {
  10. " __ __ _____ _ _ _ ",
  11. " | \\/ | | __ \\ | | | ( ) ",
  12. " | \\ / | ___| | | | ___ _ __ __ _| | __| |/ ___ ",
  13. " | |\\/| |/ __| | | |/ _ \\| '_ \\ / _` | |/ _` | / __|",
  14. " | | | | (__| |__| | (_) | | | | (_| | | (_| | \\__ \\",
  15. " |_| |_|\\___|_____/ \\___/|_| |_|\\__,_|_|\\__,_| |___/"
  16. }
  17.  
  18. -- Center text function
  19. local function centerText(y, text, color)
  20. mon.setTextColor(color or colors.white)
  21. local x = math.floor((w - #text) / 2) + 1
  22. mon.setCursorPos(x, y)
  23. mon.write(text)
  24. end
  25.  
  26. -- Draw a button
  27. local function drawButton(x, y, width, height, text, bgColor)
  28. mon.setBackgroundColor(bgColor)
  29. for i = 0, height-1 do
  30. mon.setCursorPos(x, y+i)
  31. mon.write(string.rep(" ", width))
  32. end
  33. -- Center text inside button
  34. mon.setTextColor(colors.white)
  35. local textX = x + math.floor((width - #text) / 2)
  36. local textY = y + math.floor(height / 2)
  37. mon.setCursorPos(textX, textY)
  38. mon.write(text)
  39. end
  40.  
  41. -- Animate logo line by line
  42. local function animateLogo()
  43. mon.clear()
  44. local yOffset = math.floor((h - #logo) / 2)
  45. for i, line in ipairs(logo) do
  46. centerText(yOffset + i, line, colors.white)
  47. sleep(0.15) -- delay for animation effect
  48. end
  49. end
  50.  
  51. -- Display version, prompt, and buttons
  52. local function displayInterface()
  53. local yOffset = math.floor((h - #logo) / 2) + 2
  54. centerText(yOffset + #logo + 1, "Version 1.0 | Made by JFrameXI", colors.white)
  55.  
  56. -- Draw buttons
  57. local btnY = yOffset + #logo + 7
  58. local btnWidth = 16
  59. local btnHeight = 3
  60. local spacing = 4
  61. local totalWidth = btnWidth*2 + spacing
  62. local startX = math.floor((w - totalWidth)/2) + 1
  63.  
  64. drawButton(startX, btnY, btnWidth, btnHeight, "Lightmode", colors.lightGray)
  65. drawButton(startX + btnWidth + spacing, btnY, btnWidth, btnHeight, "Darkmode", colors.gray)
  66.  
  67. return {
  68. light = {x=startX, y=btnY, w=btnWidth, h=btnHeight},
  69. dark = {x=startX+btnWidth+spacing, y=btnY, w=btnWidth, h=btnHeight}
  70. }
  71. end
  72.  
  73. -- Wait for touch and detect buttons
  74. local function waitForTouch(buttons)
  75. while true do
  76. local event, side, xTouch, yTouch = os.pullEvent("monitor_touch")
  77. local b = buttons.light
  78. if xTouch >= b.x and xTouch <= b.x + b.w - 1 and yTouch >= b.y and yTouch <= b.y + b.h - 1 then
  79. shell.run("mcdonaldsWhite")
  80. return
  81. end
  82. b = buttons.dark
  83. if xTouch >= b.x and xTouch <= b.x + b.w - 1 and yTouch >= b.y and yTouch <= b.y + b.h - 1 then
  84. shell.run("mcdonaldsBlack")
  85. return
  86. end
  87. end
  88. end
  89.  
  90. -- Run startup sequence
  91. animateLogo()
  92. local buttons = displayInterface()
  93. waitForTouch(buttons)
  94.  
  95. -- Clear screen for main program
  96. mon.clear()
  97. mon.setBackgroundColor(colors.black)
  98.  
Advertisement
Add Comment
Please, Sign In to add comment