DirectX set initial window position.
by Brandon Maness · 05/08/2005 (3:29 pm) · 0 comments
Open your winD3DVideo.cc file located in the ./engine/platformWin32 folder of your TGE source files. Around line 472 you will see this code:
Right after it paste in this code:
Recompile your exe and then load up the prefs.cs file located in your ./client/ folder. Now add this varible definition:
That will tell the game window to load up 100 pixels to the right and 50 pixels down from the top left of your screen. Set these values to where you want your window to be and again, this is only good for Windows systems using the directX video mode.
NOTE: the code segment that pulls the numbers from the console variable came from winWindow.cc... I admit I was too lazy to type it myself, and just copied/pasted it with changes I needed. Thanks GG for making and maintaining an awsome engine!
// Center the window on the desktop:
U32 xPos = ( winState.desktopWidth - adjWidth ) / 2;
U32 yPos = ( winState.desktopHeight - adjHeight ) / 2;Right after it paste in this code:
// Get the video settings from the prefs: const char* resString = Con::getVariable( "$pref::Video::setInitialPos" ); char* tempBuf = new char[dStrlen( resString ) + 1]; dStrcpy( tempBuf, resString ); char* temp = dStrtok( tempBuf, " x[[4f3985c7e1c23]]" ); xPos = ( temp ? dAtoi( temp ) : xPos ); temp = dStrtok( NULL, " x[[4f3985c7e1c23]]" ); yPos = ( temp ? dAtoi( temp ) : yPos ); delete [] tempBuf;
Recompile your exe and then load up the prefs.cs file located in your ./client/ folder. Now add this varible definition:
$pref::Video::initialWindowPos = "100 50";
That will tell the game window to load up 100 pixels to the right and 50 pixels down from the top left of your screen. Set these values to where you want your window to be and again, this is only good for Windows systems using the directX video mode.
NOTE: the code segment that pulls the numbers from the console variable came from winWindow.cc... I admit I was too lazy to type it myself, and just copied/pasted it with changes I needed. Thanks GG for making and maintaining an awsome engine!
About the author