aboutsummaryrefslogtreecommitdiff
path: root/src/game/input_configurator.cpp
blob: 4daee21f5a5f41e25867c743a82596115a0792c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "input_configurator.hpp"

namespace InputActions
{

void exit_success()
{
	exit(EXIT_SUCCESS);
}

} // namespace InputActions

InputConfigurator::InputConfigurator(std::shared_ptr<CursorController> 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<Direction::UP>(*_cursor_controller));

	input_handler.attach('j',
						 InputActions::move_cursor<Direction::DOWN>(*_cursor_controller));

	input_handler.attach('h',
						 InputActions::move_cursor<Direction::LEFT>(*_cursor_controller));

	input_handler.attach(
		'l', InputActions::move_cursor<Direction::RIGHT>(*_cursor_controller));
}