mirror of https://github.com/axmolengine/axmol.git
Merge pull request #405 from minggo/iss618
invoke java code(System.exit()) to finish programe
This commit is contained in:
commit
0c495628ea
|
@ -181,6 +181,10 @@ public class Cocos2dxActivity extends Activity{
|
||||||
public static String getCocos2dxPackageName(){
|
public static String getCocos2dxPackageName(){
|
||||||
return packageName;
|
return packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void terminateProcess(){
|
||||||
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
|
|
@ -181,6 +181,10 @@ public class Cocos2dxActivity extends Activity{
|
||||||
public static String getCocos2dxPackageName(){
|
public static String getCocos2dxPackageName(){
|
||||||
return packageName;
|
return packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void terminateProcess(){
|
||||||
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
|
|
@ -98,7 +98,7 @@ bool CCEGLView::isOpenGLReady()
|
||||||
|
|
||||||
void CCEGLView::release()
|
void CCEGLView::release()
|
||||||
{
|
{
|
||||||
exit(0);
|
terminateProcessJNI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEGLView::setTouchDelegate(EGLTouchDelegate * pDelegate)
|
void CCEGLView::setTouchDelegate(EGLTouchDelegate * pDelegate)
|
||||||
|
|
|
@ -456,4 +456,20 @@ extern "C"
|
||||||
|
|
||||||
return ret;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,13 @@ extern "C"
|
||||||
|
|
||||||
{
|
{
|
||||||
extern JavaVM *gJavaVM;
|
extern JavaVM *gJavaVM;
|
||||||
void enableAccelerometerJNI();
|
extern void enableAccelerometerJNI();
|
||||||
void disableAccelerometerJNI();
|
extern void disableAccelerometerJNI();
|
||||||
void showMessageBoxJNI(const char * pszMsg, const char * pszTitle);
|
extern void showMessageBoxJNI(const char * pszMsg, const char * pszTitle);
|
||||||
void setKeyboardStateJNI(int bOpen);
|
extern void setKeyboardStateJNI(int bOpen);
|
||||||
char* getCurrentLanguageJNI();
|
extern char* getCurrentLanguageJNI();
|
||||||
char* getPackageNameJNI();
|
extern char* getPackageNameJNI();
|
||||||
|
extern void terminateProcessJNI();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __ANDROID_COCOS2D_JNI_H__
|
#endif // __ANDROID_COCOS2D_JNI_H__
|
||||||
|
|
|
@ -181,6 +181,10 @@ public class Cocos2dxActivity extends Activity{
|
||||||
public static String getCocos2dxPackageName(){
|
public static String getCocos2dxPackageName(){
|
||||||
return packageName;
|
return packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void terminateProcess(){
|
||||||
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
|
Loading…
Reference in New Issue