From 23ff2547bb9d83be8bfa69dced24dfcadd6bb7f7 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 17 Sep 2021 17:28:12 +0100 Subject: [PATCH] little optimisation --- Aeon/Aeon.cpp | 4 ---- Aeon/Core/Events.cpp | 7 +++++-- Aeon/Core/Events.hpp | 5 ++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Aeon/Aeon.cpp b/Aeon/Aeon.cpp index 3da0861..2ef1874 100644 --- a/Aeon/Aeon.cpp +++ b/Aeon/Aeon.cpp @@ -13,11 +13,8 @@ App::App( const DisplayProperties& props ) , mInput() { RegisterAsSink( "ENGINE_DISPLAY_CORE", 0 ); - RegisterAsSink( "ENGINE_INPUT_MOUSE", 0 ); - RegisterAsSink( "ENGINE_INPUT_KEYBOARD", 0 ); mDisplay.Create( props ); - } void App::Run() @@ -35,7 +32,6 @@ const Display& App::GetDisplay() bool App::EventRecieved( GenericEvent& e ) { - //std::cout << e.Type << std::endl; if ( e.Type == "DISPLAY_CLOSED" ) { mSIGTERM = true; diff --git a/Aeon/Core/Events.cpp b/Aeon/Core/Events.cpp index 3d96b43..41fbc7a 100644 --- a/Aeon/Core/Events.cpp +++ b/Aeon/Core/Events.cpp @@ -125,10 +125,13 @@ void EventManager::RemoveSink( int listenerID, std::string system ) void EventManager::Dispatch( int dispatcherID, GenericEvent e ) { - // TODO: if there's no sinks, discard the event because it would be - // unneccesary effort to keep going with it std::string targetSink = mSources[dispatcherID]; auto sinks = mSinks[targetSink]; + + if ( sinks.empty() ) + { + return; + } for ( auto& listenerPair : sinks ) { diff --git a/Aeon/Core/Events.hpp b/Aeon/Core/Events.hpp index e4ebfe7..0a94d56 100644 --- a/Aeon/Core/Events.hpp +++ b/Aeon/Core/Events.hpp @@ -27,6 +27,9 @@ namespace Aeon::Core { /* * Engine event systems / type * ENGINE_SYSTEM_CORE - start, stop, pause, etc +* ENGINE_START - starts game loop execution +* ENGINE_STOP +* ENGINE_PAUSE * ENGINE_DISPLAY_CORE - window open, window close, etc * DISPLAY_RESIZE (x, y) - rezise to x, y being new w, h * DISPLAY_MOVE (x, y) - move to x, y @@ -51,7 +54,7 @@ namespace Aeon::Core { * ENGINE_INPUT_KEYBOARD * KEYBOARD_KEYDOWN - keycode * KEYBOARD_KEYUP - keycode -* KEYBOARD_PRESSED - keycode for continual pressing +* KEYBOARD_KEYPRESS - keycode for continual pressing */