Game Development Community

iPhone Refusing to Display Portrait Mode

by Dave Calabrese · in iTorque 2D · 06/10/2009 (11:03 am) · 7 replies

Okay... I think this is the weirdest problem I have encountered yet, and I've been trying to figure it out for about 6 hours now (causing my first App-a-Day to get delayed because of this).

When running the game on the iPhone or the Simulator, it flat out is refusing to display portrait mode. It will only display the game in landscape. I've triple checked all the values - we're at 320x480 everywhere, everything is set to Portrait, but when the came starts the whole screen and camera is tilted on its side, but the game scene is still displayed where it should be. (So imagine looking into a doorway, then tilting the camera on its side and placing it on the floor - that's what I'm seeing).

Right now, I'm really stumped. I've never seen this before, and this is the fourth iPhone app I've worked on in iTGB. Did I encounter some sort of a really rare and bizarre bug?

#1
06/10/2009 (11:09 am)
You need to change 2 things before the build and clean in the game editor:

1. Go to the preferences, iphone prefs and set it
2. Select the scenegraph, go to edit and set the camera to the corresponding mode

Step 2 anunintuitive (and at least for me very disliked) requirement to get the iphone editor to even create iphone games.
#2
06/10/2009 (11:28 am)
Double checked those... they are all set correctly. Completely rebuilt project from scratch and the problem persists... =/
#3
06/10/2009 (12:34 pm)
Put a breakpoint in iPhoneWindow.mm line 166 and see what the value is. Clearly, you are setting it, but somewhere along the way it's being changed or defaulted or something.
#4
06/10/2009 (3:22 pm)
This officially just got stranger. I found that yes, it is getting the data to go into portrait mode, but it's ignoring it. So I flat out forced the code to go into portrait mode by doing...

//get screen orientation prefs
	//gScreenOrientation = Con::getVariable( "$pref::iPhone::ScreenOrientation" );//options	portrait landscape
	//gScreenUpsideDown = Con::getBoolVariable( "$pref::iPhone::ScreenUpsideDown" );
	
	//if( dStrstr(gScreenOrientation, "Portrait" ) ) {
		platState.portrait = true;
	//} else if( dStrstr(gScreenOrientation, "Landscape" ) ) {
	//	platState.portrait = false;
	//}

And you know what? It is _STILL_ in landscape mode!!

Maybe I've been staring at it for too long, but that's getting weird.... think I need to come back to this with a fresh mind.
#5
06/10/2009 (11:47 pm)
Well... I was able to fix it by creating an all new project and porting my code over, so I'm back on track now with App-a-Day. I'm still not sure what caused this problem, though I kept the old project around so I can fish through it when I've got some time and figure out what happened. If it turns out to be a bug, I can hopefully figure out a fix. (Or, if it was just my own screw-up, know how not to do it again).
#6
01/21/2010 (12:00 pm)
I have found the file mainScreen.gui (yourproject/game/gui/mainScreen.gui)
is not changing when you change your preferences in the iTGB 1.3 editor.

You have to change this lines:

Extent = "320 480";
MinExtent = "320 480";

manually and save the file. 320 480 for portrait and 480 320 for landscape.

Hope this helps,

Raquel
#7
01/25/2010 (4:26 am)
yupp thats a new requirement in 1.3

unsure if documented but thats a thing mentioned on the mouse event handler thread as the mouse events are related to it too (seems like related to minextent as my extent was larger than the screen actually