I'm currently porting a game to the iPad.
Beside running in some memory issues it's running ok.
however I was not able to switch to landscape mode. just setting the width and height will not do the trick.
is there any way to do so?
I know that I could just set up everything in portrait mode and then rotate the camera. however I have quite many UI elements that area actually positioned relative to the camera. therefore they will be rotated as well.
thanks for any help
As we're pure OpenGL there's no real landscape/portrait mode. Going with camera rotation and switching dimensions is the way to go, but as you experienced, that doesn't solve UI positionning problems.
For that I added the option of having camera parenting. This way you can have two camera with a parent/child relation. One camera is only used as a dummy for setting UI objects with the CameraParent property (but won't be linked to a viewport for rendering, so it's only acting as a node in the frame hierarchy but that can still be accessed from config) and the other camera will render the world and will be rotated to suit your needs. As both camera are linked, your UI objects will still move with the real camera.
I'm not sure if what I just described is clear or not, I can post an example in a couple of weeks when I go back to USA as it's what I did when I was porting orx to iPhone and was using Drops as a test project.
It wasn't 100% clear to me, yet. some sample code/config would be nice.
so how do you actually link two cameras in a parent/child fashion?
the wiki arcticle of the camera doesn't state a option for that.
are the sources of drops anywhere available?
As for the sources of Drops, they're on my computer at home, that's why I can't access them before going back there in 2 weeks.
If I find enough time here, I'll try to write a short tutorial about that, but don't count too much on it.
The goal of the second camera is simply to introduce a node in the frame hierarchy that can be used to attach child objects on it and which won't be affected by the main camera's rotation.
The fact it's a camera is only because we can only attach objects on camera in the config file, so it's a bit of a hack as you can see.
Is this what you were describing?
I know experience a problem with that setup. I just connected my ipad to a projector.
because the game is in portrait mode on the ipad the whole thing will also show up in portrait mode on the projector. which means you have to tilt your head by 90 degrees to see it right.
is there any easy way of changing the game to "native" landscape mode?
Maybe that would do the trick: http://stackoverflow.com/questions/2647786/landscape-mode-only-for-iphone-or-ipad
If not, maybe your projector has a setting to rotate the display as most modern monitors have?
setting the rotation on the project is something that works for me but I'd rather not require that from any users/customers.
If you find the answer, I'd be happy to know it.
so e.g. running angry birds displays everything quite fine.(in landscape)
or if you're on the home screen the mode that's used for the projector is switched when turning the device the same way as it is on the device itself.
after cleaning the project and building it again the simulator shows up in landscape. I don't have a cable here right now, so I can not test it before tomorrow.
I'll let you know what I find out
so otherwise I just set the UIInterfaceOrientation in the plist.info to UIInterfaceOrientationLandscapeLeft and furthermore switch width and height in the display section.
now everything works fine. I'm quite suprised that it was that easy.
maybe we should put a hint to the wiki.
Yup, a page in the wiki might be a good thing. Do you feel like adding it?