From 6119f1428b3615e4738a121c6acf343942107fd9 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 5 Mar 2022 13:26:55 +0100 Subject: refactor: move input config to own file & improve cleanup --- src/engine/game_initializer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/engine/game_initializer.cpp') 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 #include GameInitializer::GameInitializer(std::shared_ptr scene, @@ -14,8 +17,14 @@ GameInitializer::GameInitializer(std::shared_ptr 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); } -- cgit v1.2.3-18-g5258