Game Development Community

InitWindow and setScreenMode bugs and fixes - iTGB 0.8.5

by Pavel Tovarys · in iTorque 2D · 09/21/2008 (8:43 am) · 0 replies

Hello,

Here are two solutions of some bugs in iTGB 0.8.5.

No. 1:

If you don't set $pref::iPhone::ScreenOrientation, Platform::initWindow() uses TRUE (because platState.portait is TRUE), but OpenGLDevice::setScreenMode() uses FALSE, so one function sets portrait mode, but the second sets landscape mode


No. 2:

OpenGLDevice::setScreenMode() doesn't count center points well at the end. It looks like it is set to a resolution 480x480 wittingly, but I think it is not the best way. It should be something as:

CGPoint point;
	if( portrait ) {
		point.x = newRes.w - (newRes.w / 2);
		point.y = newRes.h / 2;
	} else {
		if( gScreenUpsideDown ) {
			point.x = newRes.w / 2;
			point.y = newRes.h - (newRes.h / 2);
		} else {
			point.x = newRes.w / 6;
			point.y = newRes.h - (newRes.h / 2);
		}
	}
	[platState.ctx centerOnPoint: point ];

But there is no gScreenUpsideDown part for if( portrait ), so it needs still some changes