Game Development Community

TGB on Widescreen monitors

by Bruno · in Torque Game Builder · 04/30/2010 (10:50 am) · 0 replies

Hi everyone,

Does anyone has problems running TGB games on WideScreen monitors ? It seems that in window mode, the TGB window won't be centered in the center of the screen (usually at resolutions like 1920x1080, the TGB window is moved to the left of the screen leaving 30% of it out of the screen.
I was checking the TGB source code, and this looks perfectly fine :


// Adjust the window rect to compensate for the window style:
RECT windowRect;
windowRect.left = windowRect.top = 0;
windowRect.right = newRes.w;
windowRect.bottom = newRes.h;

AdjustWindowRect( &windowRect, GetWindowLong( winState.appWindow, GWL_STYLE ), false );
U32 adjWidth = windowRect.right - windowRect.left;
U32 adjHeight = windowRect.bottom - windowRect.top;

// Center the window on the desktop:
U32 xPos = ( winState.desktopClientWidth - adjWidth ) / 2;
U32 yPos = ( winState.desktopClientHeight - adjHeight ) / 2;
test = SetWindowPos( winState.appWindow, 0, xPos, yPos, adjWidth, adjHeight, SWP_NOZORDER );



But, as i can tell, SetWindowPos is failing for some reason.
Tryng to find why SetWindowPos may fail, i stepped into this :

http://msdn.microsoft.com/en-us/library/ms633545%28VS.85%29.aspx

Any idea why this is happening ?
thanks,
Bruno