• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Draw, draw GUI and trying to keep everything aligned

G

Geniusbat

Guest
Ok, I´m starting to implement the GUI into my game. In the middle of the development I decided to resize the view and port size to 960x540 (instead of 1920x1080). So, I achieved (by trial and error) to keep everything aligned when on fullscreen, but as soon as I change the port size everything goes wild. Basically the GUI that is drawed using Draw GUI event just stops doing it right, anyone can try to explain me exactly how it work? Tried documentation but can´t really understand it (warning, I´m using GMS 1) and also, why using Draw GUI doesn´t scale things as the Draw event does?

Thanks a lot
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Just call display_set_gui_size to set it to the size that works for you on game start and everything should be fine. So if 1920x1080 is what you designed the GUI layer around, then use that for the display_set_gui_size. Basically, the GI layer will be set to the initial size of the view port, so if you change that then you change the GUI layer scale. Calling the function I mention prevents the GUI layer from scaling automatically and sets it to your defined "standard" size.
 
  • Like
Reactions: Yal

Yal

🐧 *penguin noises*
GMC Elder
To elaborate on what Nocturne says, the GUI is, by default, always the size as the game window. If you resize the game window (e.g., by entering fullscreen mode), the GUI layer change size to match. To make the GUI not get deformed (e.g. super tiny), you can use display_set_gui_size() to force it to be a certain size, and it will be stretched to cover the entire game window instead or resized.
 
Top