Merge pull request #12488 from WenhaiLin/v3-37-androidApplicationFix

Fixed Application may be created more than once on Android.
This commit is contained in:
pandamicro 2015-06-23 19:43:39 +08:00
commit 32accbf21b
22 changed files with 24 additions and 25 deletions

View File

@ -42,7 +42,7 @@ THE SOFTWARE.
#define LOG_TAG "main"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
void cocos_android_app_init(JNIEnv* env, jobject thiz) __attribute__((weak));
void cocos_android_app_init(JNIEnv* env) __attribute__((weak));
using namespace cocos2d;
@ -53,6 +53,8 @@ JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved)
{
JniHelper::setJavaVM(vm);
cocos_android_app_init(JniHelper::getEnv());
return JNI_VERSION_1_4;
}
@ -66,8 +68,6 @@ JNIEXPORT void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, j
glview->setFrameSize(w, h);
director->setOpenGLView(glview);
//cocos_android_app_init(env, thiz);
cocos2d::Application::getInstance()->run();
}
else
@ -85,7 +85,6 @@ JNIEXPORT void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, j
JNIEXPORT jintArray Java_org_cocos2dx_lib_Cocos2dxActivity_getGLContextAttrs(JNIEnv* env, jobject thiz)
{
cocos_android_app_init(env, thiz);
cocos2d::Application::getInstance()->initGLContextAttrs();
GLContextAttrs _glContextAttrs = GLView::getGLContextAttrs();

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -10,7 +10,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -11,7 +11,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -11,7 +11,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -10,7 +10,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -10,7 +10,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -10,7 +10,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -10,7 +10,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
JavaVM* vm;

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
JavaVM* vm;

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new (std::nothrow) AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new (std::nothrow) AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -9,7 +9,7 @@
using namespace cocos2d;
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}