NRE_EventSystem.hpp
Go to the documentation of this file.
1 
10  #pragma once
11 
12  #include <memory>
13 
14  #include "../Graphics/Window/NRE_Window.hpp"
17  #include "Event/NRE_Event.hpp"
18 
19  #include <Header/NRE_Utility.hpp>
20 
25  namespace NRE {
30  namespace Event {
31  template<class> class EventHandler;
32  }
33 
38  namespace System {
39 
44  class EventSystem {
45  private : // Fields
46  Event::InputManager inputManager;
47  Utility::Vector<std::unique_ptr<Event::AbstractEventEmitter>> emitters;
49  public : // Methods
50  //## Constructor ##//
54  EventSystem();
55 
56  //## Copy Constructor ##//
61  EventSystem(EventSystem const& sys) = delete;
62 
63  //## Move Constructor ##//
68  EventSystem(EventSystem && sys) = delete;
69 
70  //## Deconstructor ##//
74  ~EventSystem() = default;
75 
76  //## Methods ##//
77  #ifdef _WIN32 // Windows
78 
87  LRESULT internalDispatcher(Graphics::Id id, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
88  #elif __linux__
89 
93  void internalDispatcher(XEvent const& event);
97  bool hasNextEvent();
98  #endif
99 
102  void update();
108  template <class T, class ... Args>
109  bool emit(Args && ... args);
114  template <class T>
115  void addHandler(Event::EventHandler<T>* handler);
120  template <class T>
121  void removeHandler(Event::EventHandler<T>* handler);
125  template <class T>
126  void registerEvent();
127 
128  //## Assignment Operator ##//
134  EventSystem& operator =(EventSystem const& sys) = delete;
140  EventSystem& operator =(EventSystem && sys) = delete;
141 
142  private : // Static
146  template <class T>
147  Event::EventEmitter<T>& getEmitter();
148  };
149  }
150  }
151 
152  #include "NRE_EventSystem.tpp"
Manage the event sub system.
Definition: NRE_EventSystem.hpp:44
Manage the process of native input.
Definition: NRE_InputManager.hpp:42
Declaration of Event&#39;s API&#39;s Object : InputManager.
Manage event emission to all listener.
Definition: NRE_EventEmitter.hpp:30
Event&#39;s API.
System&#39;s API.
Declaration of Event&#39;s API&#39;s Object : EventEmitter.
The NearlyRealEngine&#39;s global namespace.
Manage an event handler for a special type.
Definition: NRE_EventHandler.hpp:32
Declaration of Event&#39;s API&#39;s Events.