This commit is contained in:
natural-law 2011-07-20 15:35:52 +08:00
commit 32e7ee6e2f
8 changed files with 39 additions and 8 deletions

View File

@ -181,6 +181,10 @@ public class Cocos2dxActivity extends Activity{
public static String getCocos2dxPackageName(){
return packageName;
}
public static void terminateProcess(){
android.os.Process.killProcess(android.os.Process.myPid());
}
@Override
protected void onResume() {

View File

@ -181,6 +181,10 @@ public class Cocos2dxActivity extends Activity{
public static String getCocos2dxPackageName(){
return packageName;
}
public static void terminateProcess(){
android.os.Process.killProcess(android.os.Process.myPid());
}
@Override
protected void onResume() {

View File

@ -6,6 +6,8 @@
#include <android/log.h>
#include <jni.h>
#include <cstring>
#define LOG_TAG "CCApplication_android Debug"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)

View File

@ -98,7 +98,7 @@ bool CCEGLView::isOpenGLReady()
void CCEGLView::release()
{
exit(0);
terminateProcessJNI();
}
void CCEGLView::setTouchDelegate(EGLTouchDelegate * pDelegate)

View File

@ -456,4 +456,20 @@ extern "C"
return ret;
}
//////////////////////////////////////////////////////////////////////////
// terminate the process
//////////////////////////////////////////////////////////////////////////
void terminateProcessJNI()
{
TMethodJNI t;
if (getMethodID(t
, "org/cocos2dx/lib/Cocos2dxActivity"
, "terminateProcess"
, "()V"))
{
t.env->CallStaticObjectMethod(t.classID, t.methodID);
}
}
}

View File

@ -30,12 +30,13 @@ extern "C"
{
extern JavaVM *gJavaVM;
void enableAccelerometerJNI();
void disableAccelerometerJNI();
void showMessageBoxJNI(const char * pszMsg, const char * pszTitle);
void setKeyboardStateJNI(int bOpen);
char* getCurrentLanguageJNI();
char* getPackageNameJNI();
extern void enableAccelerometerJNI();
extern void disableAccelerometerJNI();
extern void showMessageBoxJNI(const char * pszMsg, const char * pszTitle);
extern void setKeyboardStateJNI(int bOpen);
extern char* getCurrentLanguageJNI();
extern char* getPackageNameJNI();
extern void terminateProcessJNI();
}
#endif // __ANDROID_COCOS2D_JNI_H__

View File

@ -328,7 +328,7 @@ CCTexture2D * CCTextureCache::addPVRImage(const char* path)
}
else
{
CCLOG("cocos2d: Couldn't add PVRImage:%s in CCTextureCache",key);
CCLOG("cocos2d: Couldn't add PVRImage:%s in CCTextureCache",key.c_str());
}
return tex;

View File

@ -181,6 +181,10 @@ public class Cocos2dxActivity extends Activity{
public static String getCocos2dxPackageName(){
return packageName;
}
public static void terminateProcess(){
android.os.Process.killProcess(android.os.Process.myPid());
}
@Override
protected void onResume() {