From eecf4b1e666211a13afa56f93477c55e8fd01621 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 2 Jun 2022 19:51:54 +0200 Subject: feat: implement game of life --- src/bootstrap.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/bootstrap.cpp') 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 &scene, const std::shared_ptr &cursor_controller, - const std::shared_ptr user_input_observer) + const std::shared_ptr &user_input_observer) { std::shared_ptr statusline = container.get()(cursor_controller, scene); @@ -62,12 +64,15 @@ auto bootstrap() noexcept -> yacppdic::Container std::shared_ptr generation_tracker = container.get()(true); + const auto cell_helper_factory = container.get>(); + return std::make_unique( scene, cursor_controller, generation_tracker, status_manager, - user_input_observer); + user_input_observer, + cell_helper_factory(*(scene->get_matrix()))); }); container.bind().to_factory( @@ -109,5 +114,11 @@ auto bootstrap() noexcept -> yacppdic::Container return std::make_unique(is_paused); }); + container.bind>().to_factory( + [](const IMatrix &matrix) + { + return std::make_unique>(matrix); + }); + return container; } -- cgit v1.2.3-18-g5258