mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocoscodeide/cocos2d-x into v3luaruntime
This commit is contained in:
commit
7c8e237ee2
|
@ -3,6 +3,7 @@
|
|||
#include "2d/platform/android/jni/JniHelper.h"
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include "ConfigParser.h"
|
||||
|
||||
#define LOG_TAG "main"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
||||
|
@ -13,3 +14,16 @@ void cocos_android_app_init (JNIEnv* env, jobject thiz) {
|
|||
LOGD("cocos_android_app_init");
|
||||
AppDelegate *pAppDelegate = new AppDelegate();
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
bool Java_org_cocos2dx_lua_AppActivity_nativeIsLandScape(JNIEnv *env, jobject thisz)
|
||||
{
|
||||
if (!ConfigParser::getInstance()->isInit())
|
||||
{
|
||||
ConfigParser::getInstance()->readConfig();
|
||||
}
|
||||
return ConfigParser::getInstance()->isLanscape();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,12 @@ public class AppActivity extends Cocos2dxActivity{
|
|||
// TODO Auto-generated method stub
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if(nativeIsLandScape()) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
} else {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
|
||||
//2.Set the format of window
|
||||
|
||||
// Check the wifi is opened when the android:debuggable is "true".
|
||||
|
@ -115,4 +121,6 @@ public class AppActivity extends Cocos2dxActivity{
|
|||
return null;
|
||||
}
|
||||
|
||||
private static native boolean nativeIsLandScape();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue