yes
This commit is contained in:
24
Runtime/Sources/Core/EventBus.cpp
git.filemode.normal_file
24
Runtime/Sources/Core/EventBus.cpp
git.filemode.normal_file
@@ -0,0 +1,24 @@
|
||||
#include <Core/EventBus.h>
|
||||
#include <Core/Logs.h>
|
||||
|
||||
namespace Scop
|
||||
{
|
||||
void EventBus::Send(const std::string& listener_name, const EventBase& event)
|
||||
{
|
||||
for(const EventListener& listener : s_listeners)
|
||||
{
|
||||
if(listener.GetName() == listener_name)
|
||||
{
|
||||
listener.Call(event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Warning("Event Bus : listener not found, '%'", listener_name);
|
||||
}
|
||||
|
||||
void EventBus::SendBroadcast(const EventBase& event)
|
||||
{
|
||||
for(const EventListener& listener : s_listeners)
|
||||
listener.Call(event);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user