From 3b326d77dceb3cc70abd54943689d76ecd96fc8b Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 27 Mar 2022 19:48:13 +0200 Subject: refactor: use cin in input handler --- src/engine/user/input.cpp | 3 ++- src/engine/user/input.hpp | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 #include 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 #include #include -#include #include class InputHandler : public IInputHandler, public AutoWirable -- cgit v1.2.3-18-g5258