Hi. I’m a first time poster with a starter issue. I’ve almost got the Android-NDK-port all straightened out except for this: the orientation is always either landscape or upside down. This issue is present both for the emulator and physical device. Here are some details.
Calls to “CCDirectory~~>setDeviceOrientation" have limited effect in the win32 version but this parameter seems to have no effect in the NDK-port.
Changes to the “android:orientation” in the NDK-port’s application manifest, however, show up as upside-down portrait for “landscape” and sideways for “portrait”.
I’ve included 2 pictures to illustrate what I mean and below is some of the code that is used in my project. If you need anything else, just ask.
I’m sure this is a silly misstep on my part, but I can’t seem to resolve it. I started with the “hello world” app as a template to build from, which might have something to do with my problems. I’d done a good amount of searching before starting this post, and couldn’t see any references to the issue or a resolution.
Thanks for any help you can provide.
Jon>getWinSize;
@
daySky = CCSprite::spriteWithFile(”media/scene_sky1.png“);
CC_BREAK_IF(!daySky);
tree = CCSprite::spriteWithFile(”media/scene_tree.png“);
CC_BREAK_IF(!tree);
ground = CCSprite::spriteWithFile(”media/scene_ground.png");
CC_BREAK_IF(!ground);
CCSize size = CCDirector::sharedDirector()
daySky~~>setPosition(ccp(size.width/2, size.height/2));
tree~~>setPosition.width/2, size.height-tree~~>getContentSizeInPixels().height/2-5));
ground~~>setPosition);
this~~>addChild(daySky, 0);
this~~>addChild;
this~~>addChild(ground, 0);
@
@
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector pDirector = CCDirector::sharedDirector;
pDirector~~>setOpenGLView);
// sets landscape mode
pDirector~~>setDeviceOrientation;
// turn on display FPS
pDirector~~>setDisplayFPS;
// set FPS. the default value is 1.0/60 if you don’t call this
pDirector~~>setAnimationInterval;
// create a scene. it’s an autorelease object
CCScenepScene = PuppyComeHome::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
@
@
<?xml version="1.0" encoding="utf-8"?>
@
android1.png (177.8 KB)
android2.png (206.5 KB)