New issue
 Projects > cocos2d-x > Issues > Bug #4625

Android Orientation error

Bug #4625 [New]
steliosrb 2014-03-31 14:51 . Updated over 10 years ago

Hi Everyone,

Cocos2dx is awesome, keep up the good work...
So I am using the new cocos2dx v3.0 rc0 to build a multiplatform game...
I manage to make the game working on all orientations on iOS and the I try to make this also on Android...:D

The main idea is to call the onOrientationChange of AppDelegate.
AppDelegate.h
virtual void onOrientationChange(bool isLandscape, int w, int h);

AppDelegate.cpp
void AppDelegate::onOrientationChange(bool isLandscape, int w, int h){}

CCApplicationProtocol.h
virtual void onOrientationChange(bool isLandscape, int w, int h) = 0;

nativeactivity.cpp
....

  • cocos2d::Application::getInstance()->onOrientationChange(newWidth>newHeight,newWidth, newHeight); cocos2d::Application::getInstance()->applicationScreenSizeChanged(newWidth, newHeight); ....

The strange thing is that the onOrientationChange function is called on my
samsung galaxy s3 and everything works fine...
on the Galaxy Tab 3 it is NOT working... onOrientationChange is not called at all!!!

Does anyone have any idea what is happening?

Thanks,
Stelios

zhangxm 2014-04-01 01:31

Default orientation of Galaxy Tab is landscape while phone is portrait. So, in Galaxy Tab, orientation is not changed.

Atom PDF

Status:New
Start date:2014-03-31
Priority:Low
Due date:
Assignee:-
% Done:

0%

Category:android
Target version:-