1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Making buttons

Discussion in 'Programming' started by xyden.konos, May 9, 2017.

  1. xyden.konos

    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 :)

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice