blob: 13d9ba0f46e9344b5589d212444d498b1a753c45 (
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
|
#include "game_initializer.hpp"
#include "util/function.hpp"
#include <cstdlib>
#include <utility>
GameInitializer::GameInitializer(std::shared_ptr<IScene> scene,
std::shared_ptr<IInputHandler> input_handler,
IGameFactory game_factory)
: _scene(std::move(scene)),
_input_handler(std::move(input_handler)),
_game_factory(game_factory)
{
}
void GameInitializer::initialize()
{
_scene->enter();
_input_handler->enter_raw_mode();
std::atexit(normalize_lambda(
[this]()
{
_scene->leave();
_input_handler->leave_raw_mode();
}));
auto game = _game_factory();
game->run(*_scene, *_input_handler);
}
|