Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Enhanced recovery menu GUI in ComputerCraft
- local function drawButton(x, y, width, label, backgroundColor, textColor)
- paintutils.drawFilledBox(x, y, x + width - 1, y + 3, backgroundColor)
- term.setCursorPos(x + math.floor((width - #label) / 2), y + 1)
- term.setTextColor(textColor)
- print(label)
- end
- local function drawMenu()
- term.setBackgroundColor(colors.black)
- term.clear()
- -- Draw the menu
- drawButton(10, 5, 20, "Recover Data", colors.blue, colors.white)
- drawButton(10, 9, 20, "Restore System", colors.green, colors.white)
- -- Add more buttons as needed
- end
- local function handleClick(x, y)
- if x >= 10 and x <= 29 then
- if y == 5 then
- term.clear()
- print("Initiating data recovery...")
- -- Add your data recovery logic here
- elseif y == 9 then
- term.clear()
- print("Initiating system restoration...")
- -- Add your system restoration logic here
- -- Add more conditions for additional buttons
- end
- end
- end
- local function handleInput()
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if event == "mouse_click" then
- handleClick(x, y)
- break
- end
- end
- end
- local function main()
- drawMenu()
- handleInput()
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement