aboutsummaryrefslogtreecommitdiff
path: root/src/game/input_configurator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/input_configurator.cpp')
-rw-r--r--src/game/input_configurator.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/game/input_configurator.cpp b/src/game/input_configurator.cpp
index 4daee21..e8d2fe5 100644
--- a/src/game/input_configurator.cpp
+++ b/src/game/input_configurator.cpp
@@ -8,6 +8,14 @@ void exit_success()
exit(EXIT_SUCCESS);
}
+auto move_cursor(const Vector2 &direction, const CursorController &cursor_controller)
+{
+ return [direction, cursor_controller]()
+ {
+ cursor_controller.move(direction, 1U);
+ };
+}
+
} // namespace InputActions
InputConfigurator::InputConfigurator(std::shared_ptr<CursorController> cursor_controller)
@@ -20,14 +28,14 @@ void InputConfigurator::configure(IInputHandler &input_handler)
input_handler.attach('q', InputActions::exit_success);
input_handler.attach('k',
- InputActions::move_cursor<Direction::UP>(*_cursor_controller));
+ InputActions::move_cursor(Vector2::up(), *_cursor_controller));
input_handler.attach('j',
- InputActions::move_cursor<Direction::DOWN>(*_cursor_controller));
+ InputActions::move_cursor(Vector2::down(), *_cursor_controller));
input_handler.attach('h',
- InputActions::move_cursor<Direction::LEFT>(*_cursor_controller));
+ InputActions::move_cursor(Vector2::left(), *_cursor_controller));
input_handler.attach(
- 'l', InputActions::move_cursor<Direction::RIGHT>(*_cursor_controller));
+ 'l', InputActions::move_cursor(Vector2::right(), *_cursor_controller));
}