diff options
author | HampusM <hampus@hampusmat.com> | 2022-06-02 19:51:54 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:57:00 +0200 |
commit | eecf4b1e666211a13afa56f93477c55e8fd01621 (patch) | |
tree | 410510d6e058995174d5a5b0f535fb457a0c3542 /src/bootstrap.cpp | |
parent | 87f55120f96d0f4f80b497dc9006d89df2dda125 (diff) |
feat: implement game of lifev0.1.0
Diffstat (limited to 'src/bootstrap.cpp')
-rw-r--r-- | src/bootstrap.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bootstrap.cpp b/src/bootstrap.cpp index 02ec92d..adb53a2 100644 --- a/src/bootstrap.cpp +++ b/src/bootstrap.cpp @@ -2,6 +2,7 @@ // Interfaces #include "interfaces/argument_parser.hpp" +#include "interfaces/cell_helper.hpp" #include "interfaces/cursor.hpp" #include "interfaces/engine.hpp" #include "interfaces/game.hpp" @@ -23,6 +24,7 @@ #include "engine/graphics/statusline.hpp" #include "engine/user/cursor.hpp" #include "engine/user/input.hpp" +#include "game/cell_helper.hpp" #include "game/game.hpp" #include "game/generation_tracker.hpp" #include "game/status_manager.hpp" @@ -51,7 +53,7 @@ auto bootstrap() noexcept -> yacppdic::Container [&container]( const std::shared_ptr<IScene> &scene, const std::shared_ptr<ICursorController> &cursor_controller, - const std::shared_ptr<IUserInputObserver> user_input_observer) + const std::shared_ptr<IUserInputObserver> &user_input_observer) { std::shared_ptr<IStatusLine> statusline = container.get<IStatusLineFactory>()(cursor_controller, scene); @@ -62,12 +64,15 @@ auto bootstrap() noexcept -> yacppdic::Container std::shared_ptr<IGenerationTracker> generation_tracker = container.get<IGenerationTrackerFactory>()(true); + const auto cell_helper_factory = container.get<ICellHelperFactory<char>>(); + return std::make_unique<Game>( scene, cursor_controller, generation_tracker, status_manager, - user_input_observer); + user_input_observer, + cell_helper_factory(*(scene->get_matrix()))); }); container.bind<IRandomNumberGeneratorFactory>().to_factory( @@ -109,5 +114,11 @@ auto bootstrap() noexcept -> yacppdic::Container return std::make_unique<GenerationTracker>(is_paused); }); + container.bind<ICellHelperFactory<char>>().to_factory( + [](const IMatrix<char> &matrix) + { + return std::make_unique<CellHelper<char>>(matrix); + }); + return container; } |