aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/events.hpp7
-rw-r--r--include/ui.hpp7
2 files changed, 13 insertions, 1 deletions
diff --git a/include/events.hpp b/include/events.hpp
index 2daae56..1f06544 100644
--- a/include/events.hpp
+++ b/include/events.hpp
@@ -16,6 +16,13 @@ class World;
/// INPUT EVENTS
//////////////////////////
+struct MainSDLEvent {
+ MainSDLEvent(SDL_Event e)
+ : event(e) {}
+
+ SDL_Event event;
+};
+
struct MouseScrollEvent {
MouseScrollEvent(int sd = 0)
: scrollDistance(sd) {}
diff --git a/include/ui.hpp b/include/ui.hpp
index 519d259..67c1010 100644
--- a/include/ui.hpp
+++ b/include/ui.hpp
@@ -44,8 +44,13 @@ SDL_Keycode getControl(int index);
#include <entityx/entityx.h>
-class InputSystem : public entityx::System<InputSystem> {
+class InputSystem : public entityx::System<InputSystem>, public entityx::Receiver<InputSystem> {
public:
+ inline void configure(entityx::EventManager &ev) {
+ ev.subscribe<MainSDLEvent>(*this);
+ }
+
+ void receive(const MainSDLEvent& event);
void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override;
};