aboutsummaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/game_initializer.cpp11
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);
}