mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
dispatch show/hide event to js, included "cocos simulator" (#1500)
* add dispatchEnterBackgroundEvent for simulator * more stable when set canvas size on win32 * add isNan check for float & double * simplify event dispatch on AppDelegate
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "cocos/scripting/js-bindings/event/EventDispatcher.h"
|
||||
#include "cocos/scripting/js-bindings/event/CustomEventTypes.h"
|
||||
|
||||
#include "ide-support/CodeIDESupport.h"
|
||||
#include "runtime/Runtime.h"
|
||||
@@ -64,15 +63,11 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
CustomEvent event;
|
||||
event.name = EVENT_COME_TO_BACKGROUND;
|
||||
EventDispatcher::dispatchCustomEvent(event);
|
||||
EventDispatcher::dispatchEnterBackgroundEvent();
|
||||
}
|
||||
|
||||
// this function will be called when the app is active again
|
||||
void AppDelegate::applicationWillEnterForeground()
|
||||
{
|
||||
CustomEvent event;
|
||||
event.name = EVENT_COME_TO_FOREGROUND;
|
||||
EventDispatcher::dispatchCustomEvent(event);
|
||||
EventDispatcher::dispatchEnterForegroundEvent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user