Game Development Community

BUG: Mac window not sized at startup

by David Wyand · in Torque Game Engine · 08/09/2004 (3:07 pm) · 1 replies

Greetings!

When the createCanvas() console function in game/main.cc is called (such as using the common function initCanvas() ), a default size of the canvas is given:

Platform::initWindow(Point2I(800, 600), argv[1]);

Under Mac OSX, this default is not being used, and if a resolution is not given in the script-based preferences, then a 640x480 window will open. The code that controls this is in platformMacCarb/macCarbWindow.cc under the InitOpenGL() function. Go to that function and look for the following code:

s = dStrtok( tempBuf, " x[[62886098dc6ce]]" );
   width = ( s ? dAtoi( s ) : 640 );

   s = dStrtok( NULL, " x[[62886098dc6ce]]" );
   height = ( s ? dAtoi( s ) : 480 );

Replace it with the following (changes in bold):

s = dStrtok( tempBuf, " x[[62886098dcf2a]]" );
   width = ( s ? dAtoi( s ) : [b](windowSize.x>0 ? windowSize.x : 640)[/b] ); // DAW: Added the check for the windowSize variable

   s = dStrtok( NULL, " x[[62886098dcf2a]]" );
   height = ( s ? dAtoi( s ) : [b](windowSize.y>0 ? windowSize.y : 480)[/b] ); // DAW: Added the check for the windowSize variable

And that's it. The windowSize variable is already being initialized by the call to the InitWindow() function within the Platform::initWindow() method and just wasn't being used.

- LightWave Dave

About the author

A long time Associate of the GarageGames' community and author of the Torque 3D Game Development Cookbook. Buy it today from Packt Publishing!


#1
08/26/2004 (8:51 am)
Quick note: I committed this to HEAD today. Thanks Dave.