mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
send close event to JS (#3527)
This commit is contained in:
@@ -85,22 +85,17 @@ bool Game::init()
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void Game::onPause()
|
||||
{
|
||||
void Game::onPause() {
|
||||
cc::Application::onPause();
|
||||
|
||||
cc::CustomEvent event;
|
||||
event.name = EVENT_COME_TO_BACKGROUND;
|
||||
cc::EventDispatcher::dispatchCustomEvent(event);
|
||||
cc::EventDispatcher::dispatchEnterBackgroundEvent();}
|
||||
|
||||
// this function will be called when the app is active again
|
||||
void Game::onResume()
|
||||
{
|
||||
cc::Application::onResume();
|
||||
cc::CustomEvent event;
|
||||
event.name = EVENT_COME_TO_FOREGROUND;
|
||||
cc::EventDispatcher::dispatchCustomEvent(event);
|
||||
cc::EventDispatcher::dispatchEnterForegroundEvent();
|
||||
|
||||
cc::EventDispatcher::dispatchEnterBackgroundEvent();
|
||||
}
|
||||
|
||||
void Game::onResume() {
|
||||
cc::Application::onResume();
|
||||
cc::EventDispatcher::dispatchEnterForegroundEvent();
|
||||
}
|
||||
|
||||
void Game::onClose() {
|
||||
cc::Application::onClose();
|
||||
cc::EventDispatcher::dispatchCloseEvent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user