diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-05 13:26:55 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:54 +0200 |
commit | 6119f1428b3615e4738a121c6acf343942107fd9 (patch) | |
tree | 47eb5537674fe58ae8ad388521203b92bfb43529 /src/engine/game_initializer.cpp | |
parent | d27f1a89266e141a944f88e9080bdeca95c49da3 (diff) |
refactor: move input config to own file & improve cleanup
Diffstat (limited to 'src/engine/game_initializer.cpp')
-rw-r--r-- | src/engine/game_initializer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/engine/game_initializer.cpp b/src/engine/game_initializer.cpp index 9430999..52e109a 100644 --- a/src/engine/game_initializer.cpp +++ b/src/engine/game_initializer.cpp @@ -1,5 +1,8 @@ #include "game_initializer.hpp" +#include "util/function.hpp" + +#include <cstdlib> #include <utility> GameInitializer::GameInitializer(std::shared_ptr<IScene> scene, @@ -14,8 +17,14 @@ GameInitializer::GameInitializer(std::shared_ptr<IScene> scene, void GameInitializer::initialize() { _scene->enter(); - _input_handler->enter_raw_mode(); + std::atexit(normalize_lambda( + [this]() + { + _scene->leave(); + _input_handler->leave_raw_mode(); + })); + _game->run(*_scene, *_input_handler); } |