mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Native platform modifies exit process (#14141)
This commit is contained in:
@@ -255,7 +255,6 @@ public:
|
||||
addTouchEvent(i, motionEvent);
|
||||
}
|
||||
}
|
||||
|
||||
events::Touch::broadcast(touchEvent);
|
||||
touchEvent.touches.clear();
|
||||
return true;
|
||||
@@ -383,7 +382,6 @@ public:
|
||||
WindowEvent ev;
|
||||
ev.type = WindowEvent::Type::CLOSE;
|
||||
events::WindowEvent::broadcast(ev);
|
||||
_androidPlatform->onDestroy();
|
||||
break;
|
||||
}
|
||||
case APP_CMD_STOP: {
|
||||
@@ -583,6 +581,10 @@ int32_t AndroidPlatform::run(int /*argc*/, const char ** /*argv*/) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AndroidPlatform::exit() {
|
||||
_app->destroyRequested = 1;
|
||||
}
|
||||
|
||||
int32_t AndroidPlatform::loop() {
|
||||
IXRInterface *xr = getInterface<IXRInterface>();
|
||||
while (true) {
|
||||
@@ -599,10 +601,13 @@ int32_t AndroidPlatform::loop() {
|
||||
|
||||
// Exit the game loop when the Activity is destroyed
|
||||
if (_app->destroyRequested) {
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Exit the game loop when the Activity is destroyed
|
||||
if (_app->destroyRequested) {
|
||||
break;
|
||||
}
|
||||
if (xr && !xr->platformLoopStart()) continue;
|
||||
_inputProxy->handleInput();
|
||||
if (_inputProxy->isAnimating() && (xr ? xr->getXRConfig(xr::XRConfigKey::SESSION_RUNNING).getBool() : true)) {
|
||||
@@ -626,6 +631,8 @@ int32_t AndroidPlatform::loop() {
|
||||
#endif
|
||||
if (xr) xr->platformLoopEnd();
|
||||
}
|
||||
onDestroy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AndroidPlatform::pollEvent() {
|
||||
|
||||
Reference in New Issue
Block a user