mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
begenning the refactor
This commit is contained in:
35
runtime/Includes/Core/EventBus.h
git.filemode.normal_file
35
runtime/Includes/Core/EventBus.h
git.filemode.normal_file
@@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* EventBus.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/27 17:30:36 by maldavid #+# #+# */
|
||||
/* Updated: 2024/03/27 17:31:41 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef __MLX_EVENT_BUS__
|
||||
#define __MLX_EVENT_BUS__
|
||||
|
||||
#include <Core/EventBase.h>
|
||||
#include <Core/EventListener.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class EventBus
|
||||
{
|
||||
public:
|
||||
EventBus() = delete;
|
||||
static void Send(const std::string& listener_name, const EventBase& event);
|
||||
static void SendBroadcast(const EventBase& event);
|
||||
inline static void RegisterListener(const EventListener& listener) { s_listeners.push_back(listener); }
|
||||
~EventBus() = delete;
|
||||
|
||||
private:
|
||||
inline static std::vector<EventListener> s_listeners;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user