From da0913771538fd9b1ca538615fd9aa0388608466 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 9 May 2020 09:42:18 -0400 Subject: Merge audio; handle mouse events --- src/input.hpp | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'src/input.hpp') diff --git a/src/input.hpp b/src/input.hpp index fa92c39..6180388 100644 --- a/src/input.hpp +++ b/src/input.hpp @@ -1,5 +1,5 @@ /** - * @file window.hpp + * @file input.hpp * Handles user input received from SDL. * * Copyright (C) 2019 Clyne Sullivan @@ -56,34 +56,23 @@ struct KeyDownEvent { class InputSystem : public entityx::System { public: + InputSystem(); + /** * Prepares the system for running. */ - void configure([[maybe_unused]] entityx::EntityManager& entities, - [[maybe_unused]] entityx::EventManager& events) final {} + void configure(entityx::EntityManager& entities, + entityx::EventManager& events) final; /** * Updates the system by checking for SDL events. */ - void update([[maybe_unused]] entityx::EntityManager& entities, - [[maybe_unused]] entityx::EventManager& events, - [[maybe_unused]] entityx::TimeDelta dt) final - { - for (SDL_Event event; SDL_PollEvent(&event);) { - switch (event.type) { - case SDL_KEYUP: - if (auto key = event.key; key.repeat == 0) - events.emit(key.keysym); - break; - case SDL_KEYDOWN: - if (auto key = event.key; key.repeat == 0) - events.emit(key.keysym); - break; - default: - break; - } - } - } + void update(entityx::EntityManager& entities, + entityx::EventManager& events, + entityx::TimeDelta dt) final; + +private: + bool isMouseDown; }; #endif // SYSTEM_INPUT_HPP_ -- cgit v1.2.3