JustEnoughMod
Loading...
Searching...
No Matches
EventManager.hpp
1#ifndef EVENT_EVENTMANAGER_HPP
2#define EVENT_EVENTMANAGER_HPP
3
4#include <core/AppModule.hpp>
5
6#include <util/Queue.hpp>
7
8#include <any>
9#include <memory>
10
11namespace JEM {
12 class EventManager : public AppModule {
13 public:
14 explicit EventManager(std::shared_ptr<Application> app) : AppModule(app) {}
15
16 static void push(const std::any &event) {
17 m_queue.push(event);
18 }
19
20 static auto pop() -> std::any {
21 std::any event;
22
23 if (!m_queue.empty()) {
24 event = m_queue.pop();
25 }
26
27 return event;
28 }
29
30 private:
31 static inline JEM::queue<std::any> m_queue;
32 };
33} // namespace JEM
34
35#endif
Definition AppModule.hpp:9
Definition EventManager.hpp:12
Definition Queue.hpp:11