begenning the refactor

This commit is contained in:
Kbz-8
2024-03-27 23:03:54 +01:00
parent b5983ac24b
commit 0e04356ea7
131 changed files with 2135 additions and 1192 deletions

37
runtime/Sources/Core/EventBus.cpp git.filemode.normal_file
View File

@@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* EventBus.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:36:05 by maldavid #+# #+# */
/* Updated: 2024/03/27 17:37:01 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#include <PreCompiled.h>
#include <Core/EventBus.h>
#include <Core/Logs.h>
namespace mlx
{
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);
}
}