Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to draw a filled rectangle
- function drawRect(x, y, width, height, color)
- term.setBackgroundColor(color)
- term.setCursorPos(x, y)
- term.clearLine()
- for i = 1, height do
- term.setCursorPos(x, y + i - 1)
- term.write(string.rep(" ", width))
- end
- end
- -- Function to draw text
- function drawText(x, y, text, color)
- term.setTextColor(color)
- term.setCursorPos(x, y)
- term.write(text)
- end
- -- Function to create a button
- function drawButton(x, y, width, text, bgColor, textColor)
- drawRect(x, y, width, 3, bgColor)
- drawText(x + 1, y + 1, text, textColor)
- end
- -- Function to draw the main screen
- function drawMainScreen()
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- -- Draw header
- drawRect(1, 1, 51, 5, colors.blue)
- drawText(2, 2, "Doggy OS", colors.white)
- -- Draw navigation bar
- drawRect(1, 6, 51, 3, colors.gray)
- drawButton(2, 7, 10, "Home", colors.lightGray, colors.black)
- drawButton(13, 7, 15, "Features", colors.lightGray, colors.black)
- drawButton(30, 7, 12, "About", colors.lightGray, colors.black)
- drawButton(44, 7, 8, "Help", colors.lightGray, colors.black)
- -- Draw content area
- drawRect(1, 10, 51, 10, colors.black)
- drawText(2, 11, "Welcome to Doggy OS!", colors.white)
- drawText(2, 12, "A user-friendly and secure OS.", colors.white)
- drawText(2, 14, "Press F1, F4, F5, or F6 to navigate.", colors.white)
- -- Draw footer
- drawRect(1, 22, 51, 3, colors.blue)
- drawText(2, 23, "Doggy OS - Version 1.0", colors.white)
- end
- -- Function to draw the features page
- function drawFeaturesPage()
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- -- Draw header
- drawRect(1, 1, 51, 5, colors.blue)
- drawText(2, 2, "Doggy OS - Features", colors.white)
- -- Draw content area
- drawRect(1, 10, 51, 10, colors.black)
- drawText(2, 11, "Features of Doggy OS:", colors.white)
- drawText(2, 12, "- User-friendly Interface", colors.white)
- drawText(2, 13, "- Customizable Settings", colors.white)
- drawText(2, 14, "- Fun and Interactive", colors.white)
- drawText(2, 16, "- Advanced Security Features", colors.white)
- drawText(2, 17, "- Privacy Controls", colors.white)
- -- Draw footer
- drawRect(1, 22, 51, 3, colors.blue)
- drawText(2, 23, "Press F1 to go Home", colors.white)
- end
- -- Function to draw the about page
- function drawAboutPage()
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- -- Draw header
- drawRect(1, 1, 51, 5, colors.blue)
- drawText(2, 2, "Doggy OS - About", colors.white)
- -- Draw content area
- drawRect(1, 10, 51, 10, colors.black)
- drawText(2, 11, "Security & Privacy:", colors.white)
- drawText(2, 12, "Doggy OS prioritizes your security and privacy.", colors.white)
- drawText(2, 13, "Features include:", colors.white)
- drawText(2, 14, "- Encrypted User Data", colors.white)
- drawText(2, 15, "- Regular Security Updates", colors.white)
- drawText(2, 16, "- Privacy-focused Design", colors.white)
- drawText(2, 18, "Choose between Advanced or Simple modes.", colors.white)
- -- Draw footer
- drawRect(1, 22, 51, 3, colors.blue)
- drawText(2, 23, "Press F1 to go Home", colors.white)
- end
- -- Function to draw the help page
- function drawHelpPage()
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- -- Draw header
- drawRect(1, 1, 51, 5, colors.blue)
- drawText(2, 2, "Doggy OS - Help", colors.white)
- -- Draw content area
- drawRect(1, 10, 51, 10, colors.black)
- drawText(2, 11, "Help & Instructions:", colors.white)
- drawText(2, 12, "Use the function keys to navigate.", colors.white)
- drawText(2, 13, "Press F1 for Home", colors.white)
- drawText(2, 14, "Press F4 for Features", colors.white)
- drawText(2, 15, "Press F5 for About", colors.white)
- drawText(2, 16, "Press F6 for Help", colors.white)
- drawText(2, 18, "Follow on-screen instructions for each section.", colors.white)
- -- Draw footer
- drawRect(1, 22, 51, 3, colors.blue)
- drawText(2, 23, "Press F1 to go Home", colors.white)
- end
- -- Function to handle user input
- function handleInput()
- while true do
- local event, key = os.pullEvent("key")
- if key == keys.f1 then
- drawMainScreen()
- elseif key == keys.f4 then
- drawFeaturesPage()
- elseif key == keys.f5 then
- drawAboutPage()
- elseif key == keys.f6 then
- drawHelpPage()
- elseif key == keys.q then
- break
- end
- end
- end
- -- Main Program
- drawMainScreen()
- handleInput()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement