1 | #ifndef EVENT_HANDLER_SDL2_HPP_ |
2 | #define EVENT_HANDLER_SDL2_HPP_ |
3 |
|
4 |
|
5 | #include <cstdint> |
6 | #include <vector> |
7 |
|
8 | #include "IEventHandler.hpp" |
9 |
|
10 |
|
11 | class IEventKeyboardSubscriber; |
12 | class IEventMouseSubscriber; |
13 | class IEventQuitSubscriber; |
14 | class IEventWindowSubscriber; |
15 |
|
16 |
|
17 | class EventHandlerSDL2 : public IEventHandler |
18 | { |
19 | public: |
20 | EventHandlerSDL2(); |
21 | ~EventHandlerSDL2(); |
22 |
|
23 | bool Update(uint64_t time_since_last_update_us) override; |
24 |
|
25 | bool RegisterKeyboardEventSubscriber(IEventKeyboardSubscriber *p_event_keyboard_subscriber) override; |
26 | bool RegisterMouseEventSubscriber(IEventMouseSubscriber *p_event_mouse_subscriber) override; |
27 | bool RegisterQuitEventSubscriber(IEventQuitSubscriber *p_event_quit_subscriber) override; |
28 | bool RegisterWindowEventSubscriber(IEventWindowSubscriber *p_event_window_subscriber) override; |
29 |
|
30 | private: |
31 | static constexpr uint64_t MAXIMUM_EVENT_SUBSCRIBERS = 8; |
32 |
|
33 | std::vector<IEventKeyboardSubscriber*> m_eventKeyboardSubscribers; |
34 | std::vector<IEventMouseSubscriber*> m_eventMouseSubscribers; |
35 | std::vector<IEventQuitSubscriber*> m_eventQuitSubscribers; |
36 | std::vector<IEventWindowSubscriber*> m_eventWindowSubscribers; |
37 | }; |
38 |
|
39 |
|
40 | #endif /* EVENT_HANDLER_SDL2_HPP_ */ |
41 |
|