blob: 2b0947052ebe64cb50be561da58076094a7e771c (
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
|
#include "game.hpp"
Game::Game(std::shared_ptr<IScene> scene, std::shared_ptr<IInputHandler> input_handler)
: _scene(std::move(scene)), _input_handler(std::move(input_handler))
{
}
void Game::run()
{
_scene->enter();
_input_handler->enter_raw_mode();
auto scene = _scene;
auto input_handler = _input_handler;
_input_handler->attach('q',
[&input_handler, &scene]()
{
input_handler->leave_raw_mode();
scene->leave();
exit(EXIT_SUCCESS);
});
_input_handler->listen();
_scene->leave();
}
|