Add EventTarget & EventBus (#13100)

This commit is contained in:
江战
2022-10-28 15:44:33 +08:00
committed by GitHub
parent ed4a48c480
commit 280fd976bc
117 changed files with 2826 additions and 3915 deletions
@@ -32,10 +32,6 @@
namespace cc {
SystemWindowManager::SystemWindowManager(IEventDispatch *delegate)
: _eventDispatcher(delegate) {
}
int SystemWindowManager::init() {
return SDLHelper::init();
}
@@ -46,12 +42,12 @@ void SystemWindowManager::processEvent(bool *quit) {
SDL_Window *sdlWindow = SDL_GetWindowFromID(sdlEvent.window.windowID);
// SDL_Event like SDL_QUIT does not associate a window
if (!sdlWindow) {
SDLHelper::dispatchSDLEvent(_eventDispatcher, 0, sdlEvent, quit);
SDLHelper::dispatchSDLEvent(0, sdlEvent, quit);
} else {
ISystemWindow *window = getWindowFromSDLWindow(sdlWindow);
CC_ASSERT(window);
uint32_t windowId = window->getWindowId();
SDLHelper::dispatchSDLEvent(_eventDispatcher, windowId, sdlEvent, quit);
SDLHelper::dispatchSDLEvent(windowId, sdlEvent, quit);
}
if (*quit) {
break;