mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 18:42: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:
@@ -31,7 +31,6 @@
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
|
||||
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
|
||||
#include "cocos/scripting/js-bindings/event/EventDispatcher.h"
|
||||
#include "cocos/scripting/js-bindings/event/CustomEventTypes.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_classtype.hpp"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
|
||||
@@ -98,17 +97,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