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

Windowed Mode Resizing ID

A

anomalous

Guest
I'm currently using an alarm every 30 steps that checks for a change in window size since it last checked.
If it has changed, it runs my "set resolution" script that fixes everything to match the new resolution.

This works fine when I drag corners of the window to stretch it.
This does not appear to register when I click the windows maximize or "non-maximize" toggle, even though the window obviously changes size. Is there a way to detect that or am I missing something?
That code is as follows:

Code:
alarm[0] = 30;
if window_get_width() != window_w_previous || window_get_height() != window_h_previous{
    scr_game_control_set_resolution(true);
    with o_room_control event_user(1);
    }
window_w_previous = window_get_width();
window_h_previous = window_get_height();
Les important, it seems as though if I use full-screen resolution in windowed mode, it's not correct when it comes to gui coordinates. For now, I will simply force any full screen resolution into full-screen mode, and if any other resolution I'll let it go to windowed mode. But it would still be nice to know if that's expected behavior.
 
It's really strange that your window_get_width() and window_get_height() does not return a different value when clicking the maximize button... it absolutely should.

As for your gui resolution, I don't know what your project is like, but typically you want your gui resolution to match your view or standard game resolution, so you don't have inconsistent pixel sizes between your game and gui. Default behavior is your gui size to match your window size. So you want to "lock in" your gui size by using display_set_gui_size at least once somewhere in your project. Not sure if that will help as it sounds like your project is a little unusual (since it seems to allow for full scaling).


[edit] Through my own testing, it seems to work fine. Something else must be going on.

I had an alarm with this code:

Code:
show_debug_message("Window Size:"+string(window_get_width())+"x"+string(window_get_height())); 
alarm[0]=30;
And got this output:

https://cdn.discordapp.com/attachme...02567428/94c51d83fbefb9762a5cb061e4250b53.png

Even without that exact code, you should be able to maximize/restore and see those "Resizing swap chain" messages, which is just built into GMS2.
 
Last edited:
A

anomalous

Guest
Thank you. Since you believe that's odd, I'll look a little deeper.

I do allow any screen size in this pixel game, but it has a border and a hud that changes to accommodate, so the actual game/pixel art windows are all pixel sized/appropriate. You can just see more of the world with higher resolution, snapped to some tile size.
 
Top