Advertisement
DOGGYWOOF

Untitled

Aug 24th, 2024 (edited)
5
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. -- Function to draw a filled rectangle
  2. function drawRect(x, y, width, height, color)
  3. term.setBackgroundColor(color)
  4. term.setCursorPos(x, y)
  5. term.clearLine()
  6. for i = 1, height do
  7. term.setCursorPos(x, y + i - 1)
  8. term.write(string.rep(" ", width))
  9. end
  10. end
  11.  
  12. -- Function to draw text
  13. function drawText(x, y, text, color)
  14. term.setTextColor(color)
  15. term.setCursorPos(x, y)
  16. term.write(text)
  17. end
  18.  
  19. -- Function to create a button
  20. function drawButton(x, y, width, text, bgColor, textColor)
  21. drawRect(x, y, width, 3, bgColor)
  22. drawText(x + 1, y + 1, text, textColor)
  23. end
  24.  
  25. -- Function to draw the main screen
  26. function drawMainScreen()
  27. term.clear()
  28. term.setBackgroundColor(colors.black)
  29. term.setTextColor(colors.white)
  30.  
  31. -- Draw header
  32. drawRect(1, 1, 51, 5, colors.blue)
  33. drawText(2, 2, "Doggy OS", colors.white)
  34.  
  35. -- Draw navigation bar
  36. drawRect(1, 6, 51, 3, colors.gray)
  37. drawButton(2, 7, 10, "Home", colors.lightGray, colors.black)
  38. drawButton(13, 7, 15, "Features", colors.lightGray, colors.black)
  39. drawButton(30, 7, 12, "About", colors.lightGray, colors.black)
  40. drawButton(44, 7, 8, "Help", colors.lightGray, colors.black)
  41.  
  42. -- Draw content area
  43. drawRect(1, 10, 51, 10, colors.black)
  44. drawText(2, 11, "Welcome to Doggy OS!", colors.white)
  45. drawText(2, 12, "A user-friendly and secure OS.", colors.white)
  46. drawText(2, 14, "Press F1, F4, F5, or F6 to navigate.", colors.white)
  47.  
  48. -- Draw footer
  49. drawRect(1, 22, 51, 3, colors.blue)
  50. drawText(2, 23, "Doggy OS - Version 1.0", colors.white)
  51. end
  52.  
  53. -- Function to draw the features page
  54. function drawFeaturesPage()
  55. term.clear()
  56. term.setBackgroundColor(colors.black)
  57. term.setTextColor(colors.white)
  58.  
  59. -- Draw header
  60. drawRect(1, 1, 51, 5, colors.blue)
  61. drawText(2, 2, "Doggy OS - Features", colors.white)
  62.  
  63. -- Draw content area
  64. drawRect(1, 10, 51, 10, colors.black)
  65. drawText(2, 11, "Features of Doggy OS:", colors.white)
  66. drawText(2, 12, "- User-friendly Interface", colors.white)
  67. drawText(2, 13, "- Customizable Settings", colors.white)
  68. drawText(2, 14, "- Fun and Interactive", colors.white)
  69. drawText(2, 16, "- Advanced Security Features", colors.white)
  70. drawText(2, 17, "- Privacy Controls", colors.white)
  71.  
  72. -- Draw footer
  73. drawRect(1, 22, 51, 3, colors.blue)
  74. drawText(2, 23, "Press F1 to go Home", colors.white)
  75. end
  76.  
  77. -- Function to draw the about page
  78. function drawAboutPage()
  79. term.clear()
  80. term.setBackgroundColor(colors.black)
  81. term.setTextColor(colors.white)
  82.  
  83. -- Draw header
  84. drawRect(1, 1, 51, 5, colors.blue)
  85. drawText(2, 2, "Doggy OS - About", colors.white)
  86.  
  87. -- Draw content area
  88. drawRect(1, 10, 51, 10, colors.black)
  89. drawText(2, 11, "Security & Privacy:", colors.white)
  90. drawText(2, 12, "Doggy OS prioritizes your security and privacy.", colors.white)
  91. drawText(2, 13, "Features include:", colors.white)
  92. drawText(2, 14, "- Encrypted User Data", colors.white)
  93. drawText(2, 15, "- Regular Security Updates", colors.white)
  94. drawText(2, 16, "- Privacy-focused Design", colors.white)
  95. drawText(2, 18, "Choose between Advanced or Simple modes.", colors.white)
  96.  
  97. -- Draw footer
  98. drawRect(1, 22, 51, 3, colors.blue)
  99. drawText(2, 23, "Press F1 to go Home", colors.white)
  100. end
  101.  
  102. -- Function to draw the help page
  103. function drawHelpPage()
  104. term.clear()
  105. term.setBackgroundColor(colors.black)
  106. term.setTextColor(colors.white)
  107.  
  108. -- Draw header
  109. drawRect(1, 1, 51, 5, colors.blue)
  110. drawText(2, 2, "Doggy OS - Help", colors.white)
  111.  
  112. -- Draw content area
  113. drawRect(1, 10, 51, 10, colors.black)
  114. drawText(2, 11, "Help & Instructions:", colors.white)
  115. drawText(2, 12, "Use the function keys to navigate.", colors.white)
  116. drawText(2, 13, "Press F1 for Home", colors.white)
  117. drawText(2, 14, "Press F4 for Features", colors.white)
  118. drawText(2, 15, "Press F5 for About", colors.white)
  119. drawText(2, 16, "Press F6 for Help", colors.white)
  120. drawText(2, 18, "Follow on-screen instructions for each section.", colors.white)
  121.  
  122. -- Draw footer
  123. drawRect(1, 22, 51, 3, colors.blue)
  124. drawText(2, 23, "Press F1 to go Home", colors.white)
  125. end
  126.  
  127. -- Function to handle user input
  128. function handleInput()
  129. while true do
  130. local event, key = os.pullEvent("key")
  131. if key == keys.f1 then
  132. drawMainScreen()
  133. elseif key == keys.f4 then
  134. drawFeaturesPage()
  135. elseif key == keys.f5 then
  136. drawAboutPage()
  137. elseif key == keys.f6 then
  138. drawHelpPage()
  139. elseif key == keys.q then
  140. break
  141. end
  142. end
  143. end
  144.  
  145. -- Main Program
  146. drawMainScreen()
  147. handleInput()
  148.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement