diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-22 23:13:29 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:59 +0200 |
commit | b74611d2b20fc071b8a699f2ce25e61f60118d6e (patch) | |
tree | 55d4dbf727724f7f527f2acebea83abd34317329 /src/interfaces/input.hpp | |
parent | b1183c712d94d38f75068bd62df006f73bd3550f (diff) |
refactor: improve input handling & remove commands
Diffstat (limited to 'src/interfaces/input.hpp')
-rw-r--r-- | src/interfaces/input.hpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/interfaces/input.hpp b/src/interfaces/input.hpp index f93a8e2..8239e48 100644 --- a/src/interfaces/input.hpp +++ b/src/interfaces/input.hpp @@ -7,24 +7,16 @@ #include <memory> // NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) -class IInputHandler : public IPublisher<char, std::nullptr_t> +class IUserInputObserver { public: - using Event = char; - using Context = std::nullptr_t; + using Key = char; - ~IInputHandler() noexcept override = default; + virtual ~IUserInputObserver() noexcept = default; - virtual void listen() const noexcept = 0; + virtual void listen() noexcept = 0; - void subscribe( - const Event &event, - const std::shared_ptr<ISubscriber<Context>> &subscriber) noexcept override = 0; + virtual bool is_key_pressed(Key key) noexcept = 0; - void notify_subscribers(const Event &event, const Context &context) - const noexcept override = 0; - - virtual void enter_raw_mode() noexcept = 0; - - virtual void leave_raw_mode() noexcept = 0; + virtual void clear_currently_pressed() noexcept = 0; }; |