Index

zydeco / fractal

Experiment in graphics programming, C++, OpenGL, simulation techniques.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
803 Sep 2023 23:177457fbaImGui bringupJosh Stockin110G

Blob @ zydeco / include / sdl2 / EventHandlerSDL2.hpp

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