Im developing a game using BOX2D. The plist file is set to support just the Portrait orientation. Game starts in the Portrait mode fine. Im using CCLayer for subclassing. Inorder to switch views or scenes i use the below code.
[[CCDirector sharedDirector] pushScene:[ scene]];
So all I want is to change orientation when loading the views/scenes.
1st View/Scene -> Portrait Mode
2nd View/Scene -> Landscape Mode
3rd View/Scene -> Portrait Mode
Tried few sources but was not of good help. Please help me with this. Any suggestion would be appreciated. Thank You.
It seems to me that you want to rotate the entire scene to 90 degree (- or +) to achieve portrait and landscape for your views. One simple way to do this and not getting sucked into is to create a very small layer as a pivot point that holds all your views at the center of the screen.
after you done the above, whenever you need to go for portrait or landscape mode, all you have to do is rotate the viewportLayer by 90 degree (- or +).
as an additional bonus, zooming in and out becomes an easy solution too. to achieve zooming, all you have to do is scale the viewportLayer and not worry about the children. all the calculations for collision will still work nicely because calculations for those would most likely to be done in child layers therefore not getting effected by the parent transformations.