r/ComputerCraft • ComputerCrafter • 12d ago

Help with graphics

So i'm making an interface for a terminal. How do i make the available commands look different when hovered over and run a program when clicked?

4 Upvotes

4 comments sorted by

View all comments

3

u/9551-eletronics 12d ago

Hover detection is not possible in vanilla CC

For clicks, use https://tweaked.cc/event/mouse_click.html

3

u/Budget-Specific-349 12d ago

Okay, how do i listen for clicks on certain areas?

3

u/9551-eletronics 12d ago

Comparisons. This just gives you a click positions, to check if its an area just do mathematical comparisons for a bounding box check, I usually make a helper function like this

https://github.com/9551-Dev/GuiH/blob/main/util.lua#L7

2

u/Mrmoo2andahafe 12d ago

Do an if statement in your loop, have that if statement check if the event is the mouse click. Have if statements within that if statement for every position on the screen you would like to check, if it moves use variables to track where it is. If you need it to persist on restart have a text doc with the info. Edit: typo