From eb66598c326862fd9dfc1899be4eac93f81a8023 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 8 Jun 2022 19:23:55 +0200 Subject: fix: prevent A, B, C & D from being interpreted as arrow keys --- src/engine/user/input.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/engine/user/input.hpp') diff --git a/src/engine/user/input.hpp b/src/engine/user/input.hpp index 9f565c1..12c27ee 100644 --- a/src/engine/user/input.hpp +++ b/src/engine/user/input.hpp @@ -6,6 +6,7 @@ #include #include +#include class UserInputObserver : public IUserInputObserver, @@ -16,13 +17,13 @@ public: void listen() noexcept override; - auto is_key_pressed(Key key) noexcept -> bool override; + auto get_currently_pressed_key() noexcept -> Key override; - [[nodiscard]] auto get_currently_pressed_key() const noexcept -> Key override; +private: + std::string _input_buffer; + mutable std::mutex _input_buffer_mutex; - void clear_currently_pressed() noexcept override; + auto _get_input_buffer() const noexcept -> std::string; -private: - Key _currently_pressed{}; - std::mutex _currently_pressed_mutex; + void _set_input_buffer(const std::string &input_buffer) noexcept; }; -- cgit v1.2.3-18-g5258