Cocos2d-x C++ Multi orientation support

  • energyyzer
    Likes 0

    Problem Description

    I would like to ask you for tutorial, how to manage cocos2d-x multi orientation support, how to re-draw application(frame) window, some basic – even hello world project in cocos2d-x:( not working with multiple orientations correctly.

  • Sonar Systems admin
    Likes 0

    Could you explain this a little more please.

  • energyyzer
    Likes 0

    I will expalin it based on default Cocos2d-x IOS Project hello world:

    You creating project, launching it in emulator: it is running in Landscape mode. 

    https://www.dropbox.com/s/dgucpyka2tlxuhu/iOS%20Simulator%20Screen%20Shot%2021%20Aug%202015%2014.39.07.png?dl=0

    Changing file to support Portrait mode;:

    RootViewController.mm

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

        return UIInterfaceOrientationIsPortrait(interfaceOrientation)||UIInterfaceOrientationIsLandscape(interfaceOrientation);

    }

    Launching app. In Portrait mode half scene is visible on bottom of the screen and top of the screen is black and you can’t place any object on that black area .

    https://www.dropbox.com/s/dijfnknzuyxn62a/iOS%20Simulator%20Screen%20Shot%2021%20Aug%202015%2014.43.28.png?dl=0

    So  we need somehow resize scene so it should be working after rotation like 1024x768 instead of 768x1024 like guys describing that issue there: http://discuss.cocos2d-x.org/t/trying-to-resize-scene-on-orientation-change/3459

    Hope it is more clear, like there is no need to autoamticly reposition all elements of the app, we just need to resize window to fill full phone area in new orientation and then we will place our elements on it.

     

     

     


  • Sonar Systems admin
    Likes 0

    You mean like candy crush

  • energyyzer
    Likes 0

    Yes, like candy crash. 

  • Sonar Systems admin
    Likes 0

    ok

     

    will do

Login to reply