GameMaker Fullscreen lost when screen is sleeping mode

Flaick

Member
Hi all, I have a strange issue: my game is currently running at fullscreen. Then, after a while of inactivity, starts the screen sleep mode (for saving energy). When I touch something (mouse or keys), the screen turn on but the game isn't in fullscreen anymore. I also tested with a new empty project. Did you encountered same issue? You cna simulate simply setting 1 minute to your display sleeping mode.
 

TheouAegis

Member
Are you using the built-in fullscreen mode or are you manually resizing the window?

What is the resolution of your game? What is the resolution of your monitor? What is the airspeed velocity of an unladen swallow?
 
Last edited:

Flaick

Member
Yes I use window_set_fullscreen().

Game res: 960x540
Screen res: 1920x1080
Swallow speed: about 31 mph
 
Okay, I guess I figured a workaround for anyone who still has got this problem.

GML:
if (fullscreen && window_get_height() != display_get_height()) {
    if (alarm[0] == -1) {
        window_set_fullscreen(false);
        alarm[0] = 60;
    }
  
    if (alarm[0] == 30) {
        window_set_fullscreen(true); 
    }
}
This should be tested every step. "fullscreen" is a boolean indicating whether the game should be fullscreen. Also notice that there's nothing inside the alarm[0] event (only an empty comment, as it won't count otherwise). It's not very elegant, but it's working.
 
Top