diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-10 19:12:31 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:55 +0200 |
commit | 38f14606c78c119d452f302f17329455e29a9a6f (patch) | |
tree | 03f6dfd9d3576e87260f7cb3bc436ad076b629c5 /src/game/input_configurator.cpp | |
parent | 09848ad31af6a1c70d64fccee711e231afb5a77f (diff) |
refactor: rename game initializer & move input config
Diffstat (limited to 'src/game/input_configurator.cpp')
-rw-r--r-- | src/game/input_configurator.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/game/input_configurator.cpp b/src/game/input_configurator.cpp deleted file mode 100644 index 76e5b66..0000000 --- a/src/game/input_configurator.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "input_configurator.hpp" - -namespace InputActions -{ - -void exit_success() -{ - exit(EXIT_SUCCESS); -} - -auto move_cursor(const Vector2 &direction, ICursorController &cursor_controller) -{ - return [direction, &cursor_controller]() - { - cursor_controller.move(direction, 1U); - }; -} - -} // namespace InputActions - -InputConfigurator::InputConfigurator(std::shared_ptr<ICursorController> cursor_controller) - : _cursor_controller(std::move(cursor_controller)) -{ -} - -void InputConfigurator::configure(IInputHandler &input_handler) -{ - input_handler.attach('q', InputActions::exit_success); - - input_handler.attach('k', - InputActions::move_cursor(Vector2::up(), *_cursor_controller)); - - input_handler.attach('j', - InputActions::move_cursor(Vector2::down(), *_cursor_controller)); - - input_handler.attach('h', - InputActions::move_cursor(Vector2::left(), *_cursor_controller)); - - input_handler.attach( - 'l', InputActions::move_cursor(Vector2::right(), *_cursor_controller)); -} |