Making buttons

X

xyden.konos

Guest
Alright, I'm making some buttons for a start menu. The buttons themselves are aren't drawn, but their text is. I tried to resize the buttons to match the size of the string they hold. My resize code is:

//in the create event
image_xscale = string_width_ext(button_string, -1, -1) / sprite_width;
image_yscale = string_height_ext(button_string, -1, -1) / sprite_height;

It works... sometimes... The first few buttons (Start, Settings, Exit) get scaled perfectly. But the second set of buttons that spawn after "Start" is pressed (Begin Cast, Shade Dispensary, Back) are scaled much larger than their respective strings. Why is this happening?

Some background info:
-the button sprite is a 32 x 32 white square (I use draw_self() to see how it gets scaled).
-I got a font off the web from http://www.1001fonts.com/ (maybe the way the font was made is the issue or something.)
-the strings are saved in an array and get assigned to each button in a for loop

I simply want the button's collision mask to be the same size as the string that belongs to it. Any help will be appreciated :)
 
Top