diff options
Diffstat (limited to 'src/game/game.cpp')
| -rw-r--r-- | src/game/game.cpp | 41 | 
1 files changed, 4 insertions, 37 deletions
| diff --git a/src/game/game.cpp b/src/game/game.cpp index 559f9a0..0773f2c 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -2,46 +2,13 @@  #include <utility> -Game::Game(std::shared_ptr<CursorController> cursor_controller) -	: _cursor_controller(std::move(cursor_controller)) +Game::Game(std::shared_ptr<IInputConfigurator> input_configurator) +	: _input_configurator(std::move(input_configurator))  {  } -void Game::run(IScene &scene, IInputHandler &input_handler) +void Game::run(IScene & /*scene*/, IInputHandler &input_handler)  { -	input_handler.attach('q', -						 [&input_handler, &scene]() -						 { -							 input_handler.leave_raw_mode(); -							 scene.leave(); -							 exit(EXIT_SUCCESS); -						 }); - -	auto cursor_controller = _cursor_controller; - -	input_handler.attach('k', -						 [&cursor_controller]() -						 { -							 cursor_controller->move<Direction::UP>(1U); -						 }); - -	input_handler.attach('j', -						 [&cursor_controller]() -						 { -							 cursor_controller->move<Direction::DOWN>(1U); -						 }); - -	input_handler.attach('h', -						 [&cursor_controller]() -						 { -							 cursor_controller->move<Direction::LEFT>(1U); -						 }); - -	input_handler.attach('l', -						 [&cursor_controller]() -						 { -							 cursor_controller->move<Direction::RIGHT>(1U); -						 }); - +	_input_configurator->configure(input_handler);  	input_handler.listen();  } | 
