#ifndef CLIENT_INPUT_HH_ #define CLIENT_INPUT_HH_ #include #include #include #include #include #include #include "client/render/render.hh" namespace client { namespace input { // Called on every event during update, supports multiple handlers. // using event_callback = void (*)(const SDL_Event&); using event_callback = std::function; void register_event_handler(const event_callback&) noexcept; // Empties our event queue while updating our inlines - also calls our // registered callback functions per event. void update() noexcept; void set_text_input(const bool should_start) noexcept; void set_mouse_relative(const bool is_relative) noexcept; void set_mouse_position(const glm::ivec2& d) noexcept; bool is_key_pressed(const SDL_Keycode& key) noexcept; bool is_key_toggled(const SDL_Keycode& key) noexcept; struct state { std::string text_input; bool quit; bool focused = true; bool typing; glm::vec2 mouse_pos; }; inline state state; } // namespace input } // namespace client #endif