diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-27 19:48:13 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:57 +0200 |
commit | 3b326d77dceb3cc70abd54943689d76ecd96fc8b (patch) | |
tree | 3a27f16430eb63d5610c5a166ffc2d29e5d164c8 | |
parent | 5c1c672e018e41e5c87a0263a851684a52d9c1fb (diff) |
refactor: use cin in input handler
-rw-r--r-- | src/engine/user/input.cpp | 3 | ||||
-rw-r--r-- | src/engine/user/input.hpp | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/engine/user/input.cpp b/src/engine/user/input.cpp index 5e6f517..81fe2f6 100644 --- a/src/engine/user/input.cpp +++ b/src/engine/user/input.cpp @@ -1,12 +1,13 @@ #include "input.hpp" +#include <iostream> #include <unistd.h> void InputHandler::listen() const noexcept { char character = 0; - while (read(STDIN_FILENO, &character, 1) == 1) + while (!std::cin.read(&character, 1).fail()) { notify_subscribers(character, nullptr); } diff --git a/src/engine/user/input.hpp b/src/engine/user/input.hpp index 51f3fcb..f86d0d0 100644 --- a/src/engine/user/input.hpp +++ b/src/engine/user/input.hpp @@ -7,7 +7,6 @@ #include <climits> #include <memory> #include <termios.h> -#include <unordered_map> #include <vector> class InputHandler : public IInputHandler, public AutoWirable<IInputHandler, InputHandler> |