#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 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)); }