window_set_size() issue switching fullscreen

Flaick

Member
Greetings guys, i have a strange behavior. I’m developing my game, and I put a change resolution function based on Pixellated Pope videos. It works fine except when I switch on/off the fullscreen. Let me explain:

1. I set resolution on 1600x900 and it works

2. Switch to fullscreen: ok

3. Change resolution to 1920x1080: ok

4. Come back to windowed mode. The window of game remain at 1600x900. I’ve also go into debug and when I call window_set_size() the parameters are correctly 1920 and 1080. Also if I run the program via debug and put a breakpoint, that issue doesn’t happen!

Here my code:
Code:
window_set_fullscreen(!window_get_fullscreen());
if (width >= height){
    var h = height;//min(baseHeight,height); 
    var w = height * aspectRatio; 
    
    for (i=0; i<=room_last;i++){
        if(room_exists(i)){
            room_set_width(i,w*zoom);
            room_set_height(i,h*zoom);
        }
    }
    
    //display_set_gui_size(w,h);
    display_set_gui_size(w*zoom,h*zoom);
    surface_resize(application_surface,w*zoom,h*zoom);
    window_set_size(w*zoom,h*zoom);
}
While w,h are my choosen resolution, for example 1920 and 1080 and "zoom = 1"

The last line
Code:
window_set_size(w*zoom,h*zoom);
has the correct values for w and h, but it works only in debug mode. Any idea?
 
Top