28 #ifndef BERSERK_EVENTDISPATCHER_HPP
29 #define BERSERK_EVENTDISPATCHER_HPP
36 #include <unordered_map>
139 std::unordered_map<EventType, std::vector<Listener>> mListeners;
141 std::unordered_map<Handle, EventType> mListenersTypes;
144 std::vector<Listener> mPendingAdd;
146 std::vector<Handle> mPendingRemove;
148 std::vector<std::pair<Handle, bool>> mPendingPause;
151 std::vector<Ref<Event>> mQueuedEvents;
152 std::vector<Ref<Event>> mQueuedEventsExec;
#define BRK_NS_END
Definition: Config.hpp:48
#define BRK_API
Definition: Config.hpp:32
std::size_t size_t
Definition: Typedefs.hpp:49
Root manager class.
Definition: Engine.hpp:72
Event dispatcher is responsible for managing engine events.
Definition: EventDispatcher.hpp:58
BRK_API void Dispatch(const Ref< Event > &event)
Dispatch new event to listeners.
Definition: EventDispatcher.cpp:53
BRK_API void Unsubscribe(Handle handle)
Unsubscribe listener associated with specified handle.
Definition: EventDispatcher.cpp:76
BRK_API void Resume(Handle handle)
Resume listening for events of specified listener by handle.
Definition: EventDispatcher.cpp:84
BRK_API void Pause(Handle handle)
Pause listening for events of specified listener by handle.
Definition: EventDispatcher.cpp:80
BRK_API Handle Subscribe(const EventType &eventType, ListenerFunc func, bool paused=false)
Subscribe listener function to specified event type.
Definition: EventDispatcher.cpp:62
size_t Handle
Definition: EventDispatcher.hpp:63
std::function< bool(const Event &)> ListenerFunc
Definition: EventDispatcher.hpp:61
StringName based event type.
Base class for any engine event.
Definition: Event.hpp:56
Automates reference counting and behaves as shared smart pointer.
Definition: Ref.hpp:46
Definition: GLDevice.cpp:46