Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Game starts minimised and hard to get on screen.

Credits go to J-Gamer for helping out!
This thread is locked; no one can reply to it. rss feed Print
Game starts minimised and hard to get on screen.
kovarex
Member #14,203
April 2012

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.

http://www.factorioforums.com/forum/viewtopic.php?f=41&t=3322

Any advice what could have been wrong on our side?

www.factorio.com - a factory building game.

J-Gamer
Member #12,491
January 2011
avatar

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

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

André Silva
Member #11,991
May 2010
avatar

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.

J-Gamer
Member #12,491
January 2011
avatar

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.

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

kovarex
Member #14,203
April 2012

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

#SelectExpand
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:

#SelectExpand
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.

www.factorio.com - a factory building game.

beoran
Member #12,636
March 2011

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.

Go to: