Game starts minimised and hard to get on screen.

This is something we have problem with for a long time already, we have it in our FAQ as well.

The problem is, that for some users, the game starts, but the game window is nowhere to be found, the only solution is to find the application in the Windows Task manager and maximise it from there.

Any advice what could have been wrong on our side?


I think this is the known bug of the default positioning in Windows. Try using al_set_new_window_position before creating the display.

André Silva

This happened with a few of my games as well, for some people. The solution is to provide an option to manually set the starting window position, maybe in a text file, like J-Gamer said.

If you can't be bothered to do that, and your game cannot be maximized, tell your users to right-click the program's window on the taskbar, choose move, and press either up, down, left or right on the arrow keys. That should bring it into view. I think that the window is actually really far off to the right and down. At least that's what I remember from the last time.


It being to the right-down corner of the screen might be an artifact of the default values given to al_set_new_window_position are INT_MAX. I haven't taken a look at the source code of the allegro windows port, but that might have something to do with it.


So this is what I did to fix it (I have no chance to test it, because it doesn't happen to me)

1ALLEGRO_MONITOR_INFO info; 2 if (al_get_monitor_info(0, &info)) 3 al_set_new_window_position(std::max((info.x2 - info.x1 - (width + 20)) / 2.0, 0.0), 4 std::max((info.y2 - info.y1 - (height + 35)) / 2.0, 0.0));

THe width, height are the dimensions of the display:

1this->display = al_create_display(width, height);

So I guessed the width/height of the window borders by 20/30, but I guess there is some better way to get these values.

Anyway, thanks for help, I hope it will solve the problem.


Technically speaking this is a bug of Allegro on Windows. I'll keep this in mindfor fixing it if possible, and add it to the road map as well.

Thread #614325. Printed from