diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cpp | 20 | ||||
-rw-r--r-- | src/game/game.hpp | 11 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index d7e9056..45e6a79 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1,3 +1,23 @@ #include "game.hpp" +#include "commands/insert_cell.hpp" +#include "commands/move_cursor.hpp" +#include "commands/quit.hpp" + void Game::run() noexcept {} + +std::unordered_map<char, std::shared_ptr<ICommand>> Game::get_input_config( + const std::shared_ptr<IWindow> &window, const std::shared_ptr<IScene> &scene, + const std::shared_ptr<ICursorController> &cursor_controller) const noexcept +{ + return {{'q', std::make_shared<QuitCommand>()}, + {'i', std::make_shared<InsertCellCommand>(cursor_controller, scene)}, + {'k', std::make_shared<MoveCursorCommand>(Vector2::up(), cursor_controller, + scene, window)}, + {'j', std::make_shared<MoveCursorCommand>(Vector2::down(), cursor_controller, + scene, window)}, + {'h', std::make_shared<MoveCursorCommand>(Vector2::left(), cursor_controller, + scene, window)}, + {'l', std::make_shared<MoveCursorCommand>(Vector2::right(), cursor_controller, + scene, window)}}; +} diff --git a/src/game/game.hpp b/src/game/game.hpp index 110b1c8..9ec5b41 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -1,7 +1,12 @@ #pragma once #include "DI/auto_wirable.hpp" +#include "interfaces/cursor.hpp" #include "interfaces/game.hpp" +#include "interfaces/scene.hpp" +#include "interfaces/window.hpp" + +#include <memory> class Game : public IGame, public AutoWirable<IGame, Game> { @@ -9,4 +14,10 @@ public: Game() noexcept = default; void run() noexcept override; + + [[nodiscard]] std::unordered_map<char, std::shared_ptr<ICommand>> + get_input_config(const std::shared_ptr<IWindow> &window, + const std::shared_ptr<IScene> &scene, + const std::shared_ptr<ICursorController> &cursor_controller) + const noexcept override; }; |