aboutsummaryrefslogtreecommitdiff
path: root/src/engine/engine.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-04-10 17:20:49 +0200
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:58 +0200
commitb36d072ad7a7b9c6e30fcb25d6bbb001a8393468 (patch)
tree7749fc877652bb2cf7bbd2b7c1fed5e3abe397fc /src/engine/engine.cpp
parentb828d4799a84beb1afbd889e5c4cb939a8b3df78 (diff)
refactor: add factory class & make DI container return unique ptrs
Diffstat (limited to 'src/engine/engine.cpp')
-rw-r--r--src/engine/engine.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp
index c988c33..a05fed9 100644
--- a/src/engine/engine.cpp
+++ b/src/engine/engine.cpp
@@ -9,8 +9,8 @@ CLIGameEngine::CLIGameEngine(IGameFactory game_factory, ISceneFactory scene_fact
std::shared_ptr<IInputHandler> input_handler,
std::shared_ptr<ICursorController> cursor_controller,
std::shared_ptr<IWindow> window) noexcept
- : _game_factory(game_factory),
- _scene_factory(scene_factory),
+ : _game_factory(std::move(game_factory)),
+ _scene_factory(std::move(scene_factory)),
_input_handler(std::move(input_handler)),
_cursor_controller(std::move(cursor_controller)),
_window(std::move(window))
@@ -19,7 +19,7 @@ CLIGameEngine::CLIGameEngine(IGameFactory game_factory, ISceneFactory scene_fact
void CLIGameEngine::start() noexcept
{
- auto scene = _scene_factory(_cursor_controller, _window);
+ std::shared_ptr<IScene> scene = _scene_factory(_cursor_controller, _window);
scene->enter();
_input_handler->enter_raw_mode();
@@ -29,7 +29,7 @@ void CLIGameEngine::start() noexcept
game->on_start();
std::atexit(normalize_lambda(
- [this, scene, game]()
+ [this, scene, &game]()
{
scene->leave();
_input_handler->leave_raw_mode();