I came across a rather peculiar behavior and I am wondering if this is a bug or this is by design.
What I was trying to do is to get the project to run fullscreen on both iPhone and Android.
From what I gathered from the forums in order to have horizontal orientation on Android I figured out that I need to:
@android:screenOrientation="landscape" in the manifest file
* uncomment the
view->create(480, 320); line in android/jni/project/main.cpp
In order to have horizontal orientation for iPhone I figured I needed to have
bool AppDelegate::applicationDidFinishLaunching() in the AppDelegate.
However, from what I see in the
libs/cocos2dx/platform/android/CCApplication_android.cpp file the
applicationDidFinishLaunching method is called by Android as well so the
setDeviceOrientation call will mess everything up by rotating everything once more:
if (! initInstance() || ! applicationDidFinishLaunching())
So basically what I did was guard the
setDeviceOrientation call in the app delegate with
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft); #endif
I am wondering, is this the right thing to do? What throws me off is that the initInstance section that deals with iPhone is empty and looks like this:
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) // OpenGLView initialized in testsAppDelegate.mm on ios platform, nothing need to do here. #endif // CC_PLATFORM_IOS
Why not just move the
setDeviceOrientation call there?