From 78d3c7f0480c2c886711d5477dd40ace8b02741d Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 17 Apr 2013 15:34:57 +0800 Subject: [PATCH] fixed #1613:not reload resources on Android platform after return from background --- cocos2dx/platform/CCPlatformMacros.h | 2 +- .../java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java | 2 +- .../Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp | 2 ++ samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp | 2 ++ samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp | 2 ++ samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp | 2 ++ .../CocosDragonJS/proj.android/jni/cocosdragonjs/main.cpp | 2 ++ .../CocosPlayer/proj.android/jni/cocosplayer/main.cpp | 2 ++ .../CrystalCraze/proj.android/jni/crystalcraze/main.cpp | 2 ++ .../MoonWarriors/proj.android/jni/moonwarriors/main.cpp | 2 ++ .../TestJavascript/proj.android/jni/testjavascript/main.cpp | 2 ++ .../WatermelonWithMe/proj.android/jni/watermelonwithme/main.cpp | 2 ++ template/multi-platform-cpp/proj.android/jni/hellocpp/main.cpp | 2 ++ 13 files changed, 24 insertions(+), 2 deletions(-) diff --git a/cocos2dx/platform/CCPlatformMacros.h b/cocos2dx/platform/CCPlatformMacros.h index 3b4e584e32..662bc9df9c 100644 --- a/cocos2dx/platform/CCPlatformMacros.h +++ b/cocos2dx/platform/CCPlatformMacros.h @@ -81,7 +81,7 @@ Basically,it's only enabled in android It's new in cocos2d-x since v0.99.5 */ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) - #define CC_ENABLE_CACHE_TEXTURE_DATA 1 + #define CC_ENABLE_CACHE_TEXTURE_DATA 0 #else #define CC_ENABLE_CACHE_TEXTURE_DATA 0 #endif diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java index 3451975868..731f7e3289 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java @@ -176,7 +176,7 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView { } }); - super.onPause(); + //super.onPause(); } @Override diff --git a/samples/Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp b/samples/Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp index 74f3364ff6..b24efba989 100644 --- a/samples/Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp +++ b/samples/Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp @@ -28,6 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -38,6 +39,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp b/samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp index 035fb201c4..d2731fd336 100644 --- a/samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp +++ b/samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp b/samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp index 035fb201c4..d2731fd336 100644 --- a/samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp +++ b/samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp b/samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp index 8c51db5100..1ec8b59e44 100644 --- a/samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp +++ b/samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Javascript/CocosDragonJS/proj.android/jni/cocosdragonjs/main.cpp b/samples/Javascript/CocosDragonJS/proj.android/jni/cocosdragonjs/main.cpp index 2f2d1e0c10..968e219197 100644 --- a/samples/Javascript/CocosDragonJS/proj.android/jni/cocosdragonjs/main.cpp +++ b/samples/Javascript/CocosDragonJS/proj.android/jni/cocosdragonjs/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp b/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp index ddac499f3a..0ab5514f17 100644 --- a/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp +++ b/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp @@ -31,6 +31,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -41,6 +42,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } diff --git a/samples/Javascript/CrystalCraze/proj.android/jni/crystalcraze/main.cpp b/samples/Javascript/CrystalCraze/proj.android/jni/crystalcraze/main.cpp index 2f2d1e0c10..968e219197 100644 --- a/samples/Javascript/CrystalCraze/proj.android/jni/crystalcraze/main.cpp +++ b/samples/Javascript/CrystalCraze/proj.android/jni/crystalcraze/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Javascript/MoonWarriors/proj.android/jni/moonwarriors/main.cpp b/samples/Javascript/MoonWarriors/proj.android/jni/moonwarriors/main.cpp index 2f2d1e0c10..968e219197 100644 --- a/samples/Javascript/MoonWarriors/proj.android/jni/moonwarriors/main.cpp +++ b/samples/Javascript/MoonWarriors/proj.android/jni/moonwarriors/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Javascript/TestJavascript/proj.android/jni/testjavascript/main.cpp b/samples/Javascript/TestJavascript/proj.android/jni/testjavascript/main.cpp index 2f2d1e0c10..968e219197 100644 --- a/samples/Javascript/TestJavascript/proj.android/jni/testjavascript/main.cpp +++ b/samples/Javascript/TestJavascript/proj.android/jni/testjavascript/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Javascript/WatermelonWithMe/proj.android/jni/watermelonwithme/main.cpp b/samples/Javascript/WatermelonWithMe/proj.android/jni/watermelonwithme/main.cpp index 2f2d1e0c10..968e219197 100644 --- a/samples/Javascript/WatermelonWithMe/proj.android/jni/watermelonwithme/main.cpp +++ b/samples/Javascript/WatermelonWithMe/proj.android/jni/watermelonwithme/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/template/multi-platform-cpp/proj.android/jni/hellocpp/main.cpp b/template/multi-platform-cpp/proj.android/jni/hellocpp/main.cpp index 8c51db5100..a16031c064 100644 --- a/template/multi-platform-cpp/proj.android/jni/hellocpp/main.cpp +++ b/template/multi-platform-cpp/proj.android/jni/hellocpp/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } }