Legacy GM best way to go about clickable text?

F

fxokz

Guest
Right now ive made it easy to navigate any menu with the keyboard but haven't implemented any mouse inputs. How would I go about this? The only way I can think of is point_in_rectangle but I'm not exactly sure if that's a good way to go, any other alternative?
 
B

Badger

Guest
point_in_rectangle is usually what I use. I haven't had any issues with it so far.
 

JackTurbo

Member
its just going to be a little tedious finding the widths but ill figure it out
https://docs.yoyogames.com/source/dadiospice/002_reference/strings/string_width.html


Personally I'm not super experienced with best practices for coding ui stuff, but the way I've been doing it so far is by defining a button object. This object has "text", "function", "target" and "value" variables which I define on creation.

"text" is the string to draw. "function" is used by a big switch statement that contains the code to run the various functions of the button, stuff like; room_goto, change variable, run script etc. And then "target" and "value" are used by these functions when necessary. Then I simply run a collision check on lmb click.
 
Last edited:
Top