Game Development Community

game wont run in landscape or show updates on device. help!?!(unresolved)

by Juntaou · in iTorque 2D · 05/23/2011 (6:24 pm) · 20 replies

*UPDATE*
I've been doing tests and posting the results down below

This may have been addressed somewhere else, I thought I found something earlier today that might have helped me, but now I can't seem to find it. Either way I just started working with my projects in xcode and on the actual device. Everything seemed to be fine at first, When i would run the game in the builder simulator it would run fine. Then when I switched to running the game on the device it switches it to portrait mode and I can't get it to go to landscape. So again in the simulator(builder) it runs in landscape, however in the iphone simulator or on the device it switches to landscape mode. Any ideas?

*update*
So I made a whole new project and I'm getting the same thing. Simulator(builder) works fine, when it starts on the device the orientation is correctly facing the right direction, but as soon as the level loads it goes back to portrait mode. :P

*update*
So I'm still not seeing what the problem is. I've tried deleting .dso files, maybe I've missed the ones that really need to be deleted. I've cleaned and rebuilt the project. Is this something just crazy stupid and obvious that I'm not doing right?

#1
05/23/2011 (8:12 pm)
I have had a similar issue, only with that my sceneWindow2D is fine, in portrait. However, I attempt to add a second window via the mainScreen.gui. That window, no matter what I do appears landscape, over the portrait makes for a bad combo.

Anyhow, you can follow those adventures here.
http://www.garagegames.com/community/forums/viewthread/125978

#2
05/26/2011 (8:05 pm)
*Bump*

Anyone else have any ideas? I've tried looking everywhere to see if anything other than landscape is being loaded, but everywhere I look I'm seeing that the resolution is set to 480x320x32. Again in the tgb simulator it runs in 480x320 but on the device it runs in 320x480?

Upon further inspection it doesn't seem to be updating the game at all from the first time I loaded it into xcode... That might be another problem all together...(I've tried deleting the .dso files, maybe I'm not deleting the right ones?)

Any thoughts?

I will start going through the tutorials again... maybe I missed something...
#3
05/28/2011 (3:53 pm)
*Bump*
<note> reading back over this I repeat myself a lot and sometimes what I wrote doesn't make perfect sense because I keep editing the same post as I do more tests. I'm trying to keep everything up to date on this so hopefully it all makes sense.</note>

Sorry for bumping this again, but I'm going through the tutorials, searching online, testing it myself and am probably just missing something really obvious, but I'm not seeing what I'm doing wrong.(Hopefully it is just something stupid and I can move on...)

So here is the latest example of what I did to test it.

1) Created a new project in iT2D name test.
2) went to project tab, selected landscape orientation and hit apply(even though it showed that it was already selected)
3) In the create tab added the static background sprites(background and near and far rocks)
4) Added all 3 to the datablocks so they should show up in the game.
5) Created an object with the background image(no rocks just the image).
6) Saved it and ran simulator... it runs fine. Background is displayed in landscape as it should.
7) Opened up xcode built and ran project on my ipod... runs, but displays image in portrait mode.
8) Back in it2d I add near and far rocks to the scene. save and run it... everything shows up in the simulator in the scene the way it should.
9) Open xcode back up via the open project in xcode button and rebuild... still shows it in portrait mode... near and far rocks are not displayed, only the background image.
10) In t2d ran simulator again... everything displays correctly still...
11) closed xcode completely down and restarted. In the supported orientation sections in xcode i choose landscape left... It starts it in that mode(the status bar that is temporarily there goes to the correct spot, but when the scene loads it is displayed in portrait.
12) stop the game, set orientation to landscape right... the status bar is displayed on the opposite side that it was on last time, as it should be... scene is still displayed in portrait mode...
13) stopped game and cleaned the project build, rebuilt everything... near and far rocks are now appearing! but it is all happening in portrait mode still.(the need to clean the project is probably mentioned in the documentation somewhere and I just missed it, or havent gotten that far yet)
14) in xcode cleaned the simulator build and rebuilt it, In the xcode simulator it is now running in landscape mode!
15) tried rebuilding for the device... its still loading in portrait mode.
16) in it2d set orientation to portrait mode, cleaned and rebuilt in xcode, game still runs in portrait mode on device... only this time a portion of the screen is cut off because the scene is now cut off from the camera being in portrait mode instead of landscape mode.

So from everything I have done I know that the scene is working correctly, the iphone is being told to load the program in the correct orientation because the status bar is in the correct orientation, but the scene itself is continuing to be loaded in the wrong orientation. In iT2D simulator it runs correctly, in xcode simulator it looks like it is running corretly, from xcode to the device it still is loading in portrait mode... I don't understand why it is the only one running incorrectly...

It might help to note that I have a 2nd gen ipod touch currently running ios 4.2.1.

I will continue doing tests and post what happens. Someone please jump in if they see the obvious mistake I'm making...
#4
05/28/2011 (9:28 pm)
Not sure,
but one thing I would check is your commonConfig.xml in your common folder. In it you will see a setting for device orientation and resolution. Set those accordingly.



Here is mine, running fine in landscape.

<TorqueGameConfiguration>
   <CommonVer></CommonVer>
   <Company>blank</Company>
   <GameName>blankBlank</GameName>
   <Resolution>480 320 32</Resolution>
   <FullScreen></FullScreen>
   <UsesAudio>1</UsesAudio>
   <DefaultScene>~/data/levels/level.t2d</DefaultScene>
</TorqueGameConfiguration>
<iDeviceSettings>
   <iDeviceType>0</iDeviceType>
   <iDeviceScreenOrientation>0</iDeviceScreenOrientation>
   <iDeviceScreenResolution>1</iDeviceScreenResolution>
   <iFeatureUseStoreKit>0</iFeatureUseStoreKit>
   <iFeatureUseNetwork>0</iFeatureUseNetwork>
   <iFeatureUseGameKit>0</iFeatureUseGameKit>
   <iFeatureUseMusic>1</iFeatureUseMusic>
   <iFeatureUseLocation>0</iFeatureUseLocation>
   <iFeatureUseMultitouch>0</iFeatureUseMultitouch>
   <iFeatureUseMoviePlayer></iFeatureUseMoviePlayer>
   <iFeatureUseAutoRotate></iFeatureUseAutoRotate>
   <iFeatureUseOrientation></iFeatureUseOrientation>
   <iFeatureStatusBarType>0</iFeatureStatusBarType>
</iDeviceSettings>
#5
05/29/2011 (8:13 pm)
Thanks for posting that Rennie although I think that mine is the same...
<TorqueGameConfiguration>
   <CommonVer>114</CommonVer>
   <Company>com.yourcompany.appname</Company>
   <GameName>MyGame</GameName>
   <Resolution>480 320 32</Resolution>
   <FullScreen />
   <UsesAudio>1</UsesAudio>
   <DefaultScene>~/data/levels/emptyLevel.t2d</DefaultScene>
</TorqueGameConfiguration>
<iDeviceSettings>
   <iDeviceType>0</iDeviceType>
   <iDeviceScreenOrientation>0</iDeviceScreenOrientation>
   <iDeviceScreenResolution>1</iDeviceScreenResolution>
   <iFeatureUseNetwork>0</iFeatureUseNetwork>
   <iFeatureUseMusic>1</iFeatureUseMusic>
   <iFeatureUseMultitouch>0</iFeatureUseMultitouch>
   <iFeatureUseMoviePlayer />
   <iFeatureUseAutoRotate />
   <iFeatureUseOrientation />
   <iFeatureStatusBarType>0</iFeatureStatusBarType>
</iDeviceSettings>
Are there any other spots that I should be checking to make sure it is loading correctly? Or is there something wrong with this?
#6
05/30/2011 (8:22 am)
I would just make sure that in the editor that level is set to landscape and apply then run. I noticed sometimes my levels, in the editor would switch (or had not been set correctly, but regardless would switch ) away from my preferred setting.


Also, check your mainScreen.gui. Is it set to 480x320, both it and the sceneWindow2D?


#7
05/30/2011 (3:44 pm)
@Juntaou

In the C++ code (function CreateCanvas) there is this code

iDeviceType = Con::getIntVariable("$pref::iDevice::DeviceType");
iDeviceRes = Con::getIntVariable("$pref::iDevice::ScreenResolution");
iDeviceOrientation = Con::getIntVariable("$pref::iDevice::ScreenOrientation");

put a breakpoint there in XCode.

this thread might help, a simpler way to define this (without the need for the CommonConfig.xml file)

www.garagegames.com/community/resources/view/21034
#8
05/31/2011 (6:16 am)
Thanks for the replies, I haven't had the chance to check everything out yet but I should be able to tonight after work.

@rennie Everywhere I have checked, everything seems to be in 480x320. Its possible that I'm missing something, but like I said everything is in that resolution. Also it runs in landscape in 2 out of the 3 environments.

@Pedro I will check that tonight and see what is actually being loaded. Thanks for the links.
#9
06/01/2011 (4:23 am)
@Pedro So I put in the breakpoint where you said and it is in fact returning a 1, which I believe is portrait mode. I haven't had the time to check to see where it was loading that, but everywhere I had looked before seemed(at least in the places where I am defining it) to be loading portrait mode into it... I guess i could just manually tell it to load landscape at the spot I'm at... However it would be nice to figure out how to get this to work correctly. Any other ideas on where to go next once I get home?

*UPDATE*

so I actually tried to manually change it just set it to 0 after the call had been made. And when I do that it still displays it in portrait orientation, but even worse its off centered now. :P So that is not even a temp fix.
#10
06/01/2011 (9:48 am)
@Juntaou

I would try to find the root cause of the problem. If you followed the default template that should work.

You can also try this simpler template, only 1 main.cs file to set these values, there is less change that something could go wrong

www.garagegames.com/community/resources/view/21034

try also deleting the exectutable folder in the Mac and rebuild all.
#11
06/01/2011 (9:07 pm)
So I've had a little bit of time to debug tonight and when I step through this

iDeviceOrientation = on::getIntVariable("$pref::iDevice::ScreenOrientation");

after it steps into the next section I get value temporarily unavailable, the other 2, iDeviceType and iDeviceRes are both returning values, but for whatever reason with the orientation I'm getting that. I will keep digging, anyone else ever see this.

@Pedro thanks for the help, if I can't get this to work I will play with your simple templates and see if I can get that to work. However it would be really nice to be able to get the basic default template working.

*update*
So I've still been trying to step through this to no avail. Here is exactly what i am seeing...

if(iDeviceType == i_IPAD)
	{
		if(iDeviceRes == i_FULLRES)
		{
			if (iDeviceOrientation == i_LANDSCAPE) 
			{
				startRes.x = i_FULLW;
				startRes.y = i_FULLH;
			}
			else 
			{
				//portrait, swap width height.
				startRes.x = i_FULLH;
				startRes.y = i_FULLW;
			}

		}
		else 
		{
			if (iDeviceOrientation == i_LANDSCAPE) 
			{
				startRes.x = i_SMALLW;
				startRes.y = i_SMALLH;
			}
			else 
			{
				//portrait, swap width height.
				startRes.x = i_SMALLH;
				startRes.y = i_SMALLW;
			}
		}

	}
	else
	{
		if (iDeviceOrientation == i_LANDSCAPE) 
		{
			startRes.x = i_SMALLW;
			startRes.y = i_SMALLH;
		}
		else 
		{
			//portrait, swap width height.
			startRes.x = i_SMALLH;
			startRes.y = i_SMALLW;
            
		}
	}

Ok so when it hits this point of the code device and resolution are correct.(I'm using a touch) so it skips over the ipad section and goes to the iphone section. It gets to the line that says:

if (iDeviceOrientation == i_LANDSCAPE)

in the iphone section. The iDeviceOrientation variable still gives me the unavailable message. The next thing that it does is skips back up to the ipad code:

if (iDeviceOrientation == i_LANDSCAPE)
{
>>>>>>>startRes.x = i_SMALLW;
startRes.y = i_SMALLH;
}

again that is the instance that is in the ipad section and while it is sitting there the orientation is now 1, which is portrait mode and it the skips down to:

>>>>>>>>>else
{
//portrait, swap width height.
startRes.x = i_SMALLH;
startRes.y = i_SMALLW;

}

in the iphone section. Here it steps in and continues to run fine, but in portrait mode. Can anyone makes sense of that? I have experience debugging projects, but debugging in xcode with this project feels like it is all over the place.
#12
06/01/2011 (9:59 pm)
@Juntaou

if you're not getting this variable in the C++ code

iDeviceOrientation = Con::getIntVariable("$pref::iDevice::ScreenOrientation");

that means it is not properly setup in script; you just have to search for it in the script files and put a couple breakpoints (if you're using Torsion; debugging without Torsion can be challenging :-) )

That C++ code is just a diagnostic of what might be wrong, it should not be changed.

#13
06/02/2011 (6:56 am)
@Pedro When you say not setup properly in the script, which script are you talking about? (Again thanks for all your help Pedro!)
#14
06/02/2011 (11:28 am)
@Juntaou

I mean the Torque script .cs files, somewhere this variable must be initialized, either read from the commonConfig.xml file or just setup like this

$pref::iDevice::ScreenOrientation = 1;
#15
06/04/2011 (11:41 am)
@Pedro thanks again, I will check that out when I get back in town next week!
#16
07/05/2011 (10:54 pm)
@Pedro thanks for all of your help it sucks to bring this back up, but I thought I had the problem fixed as it started showing the projects in landscape mode like I wanted. However now they will only show in landscape mode regardless of what I do. I can't get it to display in portrait mode. I've been debugging it and it is not correctly reading in the information from the commonconfig file. I just can't see where it is pulling it from. I don't know what I've done to upset the torque gods, but this is killing me. Why does no one else have this problem? I deleted everything torque related, well 1.4.1 re downloaded it so I have a fresh build and it still wont go into portrait mode. wtf

PS Cleaning my project made the debugging jumping everywhere problem disappear.

Also I'm not using Torsion, I thought that wasn't available on macs...
#17
07/06/2011 (8:04 pm)
@Juntaou. It's difficult to say what might be wrong without having the source code. To avoid problems like that I defined a minimal template that completely avoids the commonConfig.xml file, and other default template Torque files at all. I found *very* confusing and error prone to have all these orientation and resolution constants spread along many source files.

Only 1 file needed, main.cs; all constants are hardcoded in the same file; difficult anything can go wrong here:

www.garagegames.com/community/resources/view/21034

You can give a try to this; you can also avoid reading the commonConfig.xml file, just go to the script part where it is read and set the orientation as in post #14 above.

Torsion runs in Windows. But there are ways to run it in Mac OS. The way I did it was just to install Windows as a virtual machine with Virtual Box. I cannot imagine any Torque developer *not* using Torsion.

Just put a breakpoint at start and go from there until you find the code as in #14. You can try also to debug in XCode to see what's happening as in #7 above.

#18
08/05/2011 (11:37 am)
@Juntaou - Have you changed your interface file settings at all? In the past, I have accidentally changed MainWindow on accident and prevented it from properly rendering.
#19
08/05/2011 (11:39 am)
Actually, can you send a zip of your project to me? Use michaelp@garagegames.com
#20
08/05/2011 (1:07 pm)
@Michael I will tonight when I get home, maybe something is changing when I build or something. The problem is I have re-downloaded and re-installed many times. I was hoping 1.5 previews would change something, but they didn't. :P I can literally go download it and install it right now and I know it will do the same thing. But I will send it over, thanks.