Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting proper cocos2d orientation

In my cocos2d application, inside the applicationDidFinishLaunching method for my app delegate, I set the orientation via [director setDeviceOrientation:kCCDeviceOrientationPortrait] because I really only want portrait. However, Apple rejected my app saying it must support upside down portrait as well.

I'm not certain how I detect this, though. Reading the currentDevice orientation seems to return an unknown orientation, so my questions are twofold:

1) How am I supposed to detect the orientation so I can properly set it to either portrait or upsidedown portrait (where it will stay for good).

2) I suspect I'll have an issue with the splash screen because it's loaded before I reach this point in the delegate. How can I properly detect the orientation so I can set the right splash screen?

like image 599
Joey Avatar asked Dec 08 '25 15:12

Joey


1 Answers

I can only edit the codes to fix your first question.. i hope you are using .99.5..

in RootViewController.h, in the function

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

look for this line:

#elif GAME_AUTOROTATION == kGameAutorotationUIViewController
{
return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );
}

change to

    return ( UIInterfaceOrientationIsPortrait( interfaceOrientation ) );
like image 197
xuanweng Avatar answered Dec 12 '25 11:12

xuanweng



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!