r/ComputerCraft • • 21d ago

I wanna learn buttons and stuff

I often think it would be cool with some kind of menu that contains buttons and different pages, just for entertainment. The only thing stopping me though is poor knowledge

14 Upvotes

2 comments sorted by

7

u/Mission-Thought-7954 21d ago

you juste need to print all of you buttons on the screen/terminal and use the monitor_touch event to check for interaction :
https://tweaked.cc/event/monitor_touch.html

3

u/bryceio 21d ago

Buttons come down to displaying text with a background and then detecting when someone clicks an area that contains a button.

I made an API for creating buttons several years ago, with the source code linked in the description. Feel free to take a look and see the general idea or just try to figure it out from what I said above.

https://youtu.be/6yX2vyRjC5w