Index

zydeco / 0dd781a

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
405 Aug 2023 20:500dd781aCreate event handling and threads structureJosh Stockin1400G

Blob @ zydeco / include / sdl2 / EventHandlerSDL2.hpp

text/plain1211 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 "IEventHandler.hpp"
9
10
11class IEventKeyboardSubscriber;
12class IEventMouseSubscriber;
13class IEventQuitSubscriber;
14class IEventWindowSubscriber;
15
16
17class EventHandlerSDL2 : public IEventHandler
18{
19public:
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
30private:
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