ipad landscape mode

edited April 2011 in Help request
hey,
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 :D

Comments

  • edited April 2011
    tdomhan wrote:
    hey,
    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 :D

    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.
  • edited April 2011
    thanks for the fast reply.
    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?
  • edited April 2011
    You can use the ParentCamera attribute on a camera. It's not documented as I did it on the fly when I encountered the problem for iPhone myself and never took the time to do a proper tutorial on the wiki.
    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. :)
  • edited April 2011
    Alright I think I figured out what you ment. I described what I did here:
    http://orx-project.org/wiki/en/orx/tutorials/community/tdomhan/ipadport
    Is this what you were describing? :D
  • edited April 2011
    Yep, sounds good! Thanks for the tutorial. :)
  • edited June 2011
    hey,
    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?
  • edited June 2011
    Good question!

    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?
  • edited June 2011
    I made a quick test in setting UIInterfaceOrientation in the info.plist, but somehow it didn't change anything. I will do futher testing later on.

    setting the rotation on the project is something that works for me but I'd rather not require that from any users/customers.
  • edited June 2011
    I understand. Are you sure there's a way for the iDevice to tell the projector how it should display its content?

    If you find the answer, I'd be happy to know it. :)
  • edited June 2011
    well the projector displays it in portrait if the app is running in portrait mode and in landscape if it's running in landscape mode.

    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 :D
  • edited June 2011
    alright cleaning and rebuilding solved it.

    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.
  • edited June 2011
    Good to know, thanks for the info! :)

    Yup, a page in the wiki might be a good thing. Do you feel like adding it?
Sign In or Register to comment.