diff options
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/game.hpp | 8 | ||||
-rw-r--r-- | src/interfaces/input.hpp | 20 | ||||
-rw-r--r-- | src/interfaces/statusline.hpp | 3 |
3 files changed, 11 insertions, 20 deletions
diff --git a/src/interfaces/game.hpp b/src/interfaces/game.hpp index a54782a..3aac6a9 100644 --- a/src/interfaces/game.hpp +++ b/src/interfaces/game.hpp @@ -2,12 +2,12 @@ #include "interfaces/command.hpp" #include "interfaces/cursor.hpp" +#include "interfaces/input.hpp" #include "interfaces/scene.hpp" #include <yacppdic/factory.hpp> #include <memory> -#include <unordered_map> // NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) class IGame @@ -20,11 +20,9 @@ public: virtual void on_update() noexcept = 0; virtual void on_exit() const noexcept = 0; - - [[nodiscard]] virtual auto get_input_config() const noexcept - -> std::unordered_map<char, std::shared_ptr<ICommand>> = 0; }; using IGameFactory = yacppdic::Factory<std::unique_ptr<IGame>( const std::shared_ptr<IScene> &scene, - const std::shared_ptr<ICursorController> &cursor_controller)>; + const std::shared_ptr<ICursorController> &cursor_controller, + const std::shared_ptr<IUserInputObserver> user_input_observer)>; 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; }; diff --git a/src/interfaces/statusline.hpp b/src/interfaces/statusline.hpp index 2e97ed6..c66a2d3 100644 --- a/src/interfaces/statusline.hpp +++ b/src/interfaces/statusline.hpp @@ -14,7 +14,8 @@ enum StatusLineSection C = 2, D = 3, E = 4, - F = 5 + F = 5, + G = 6 }; // NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) |