Game Development Community

switching fullscreen to windowed not centering the window?

by Tim Scheiman · in Torque Game Builder · 03/24/2010 (2:59 pm) · 1 replies

Hey all,

If I'm running on an 800x600 size desktop, start up the game fullscreen, and then use:

setscreenmode(794,544,32,0);

To create a full-screen-sized window... it makes the window just fine, but it doesn't put it in the center of the screen! It's about 2 inches too far to the right and 1 inch too far down.

Anyone know why that happens or how to fix it? (script would be nice, but source is ok too if it's a bug)

From a 1024x768 desktop, run fullscreen, then going to a 1018x712 window -> works just fine and centers the window appropriately.

Thanks!

-Tim

#1
04/16/2010 (10:40 pm)
I've figured this one out - it's a bug in the engine. In two places in platformWin32winWindow.cc, the function adjustWindowSize is called. If it is called in fullscreen mode, it messes up and moves the window the way you've seen. The solution is to put in a test, like this:

bool fullScreen = Con::getBoolVariable( "$pref::Video::fullScreen" );
if(!fullScreen) {
adjustWindowSize();
}