• 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!

GML Constant for Room Scaling?

T

TheTrophieStars

Guest
I'm trying to create a little text box engine but I've run into a problem. When the game gets resized, everything remains small, and the gui is off centered. How can I scale everything so the game appears precisely as I want it to for any screen size. There must be a setting to make everything scale and appear appropriately?
 
G

Gillen82

Guest
Create an object and within the Create Event, add the following:

Code:
fullscreen = false;
screen_width = display_get_width();
screen_height = display_get_height();
Within the Step Event, add the following:

Code:
if(keyboard_check_pressed(vk_f4)){

    if(!fullscreen){
        fullscreen = true;
        window_set_fullscreen(true);
        display_set_gui_size(screen_width, screen_height);
        surface_resize(application_surface, screen_width, screen_height);
    } else{
        fullscreen = false;
        window_set_fullscreen(false);
        display_set_gui_size(screen_width, screen_height);
        surface_resize(application_surface, screen_width, screen_height);
    }
       
}
Make the object persistent and add it to your room

You can replace the vk_f4 with whatever key you want.

Hope this helps, or at least points you in the right direction
 
T

TheTrophieStars

Guest
Create an object and within the Create Event, add the following:

Code:
fullscreen = false;
screen_width = display_get_width();
screen_height = display_get_height();
Within the Step Event, add the following:

Code:
if(keyboard_check_pressed(vk_f4)){

    if(!fullscreen){
        fullscreen = true;
        window_set_fullscreen(true);
        display_set_gui_size(screen_width, screen_height);
        surface_resize(application_surface, screen_width, screen_height);
    } else{
        fullscreen = false;
        window_set_fullscreen(false);
        display_set_gui_size(screen_width, screen_height);
        surface_resize(application_surface, screen_width, screen_height);
    }
      
}
Make the object persistent and add it to your room

You can replace the vk_f4 with whatever key you want.

Hope this helps, or at least points you in the right direction

Thanks, how would I handle full Windowed? Or just resizing? Does the same idea apply?
 
G

Gillen82

Guest
This should handle resizing the window, while keeping aspect ratio...I think lol
 
Top