aboutsummaryrefslogtreecommitdiff
path: root/src/engine/user/input.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-06-08 19:23:55 +0200
committerHampusM <hampus@hampusmat.com>2022-06-13 17:57:01 +0200
commiteb66598c326862fd9dfc1899be4eac93f81a8023 (patch)
tree75c74e7d3a180952d9b2efc081aa4d4ef165da60 /src/engine/user/input.hpp
parent0f9f82c875fef4c8057a994552aa7d7a702b411a (diff)
fix: prevent A, B, C & D from being interpreted as arrow keys
Diffstat (limited to 'src/engine/user/input.hpp')
-rw-r--r--src/engine/user/input.hpp13
1 files changed, 7 insertions, 6 deletions
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 <memory>
#include <mutex>
+#include <string>
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;
};