diff options
Diffstat (limited to 'src/bootstrap.cpp')
-rw-r--r-- | src/bootstrap.cpp | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/bootstrap.cpp b/src/bootstrap.cpp index 22fe472..f36bc6a 100644 --- a/src/bootstrap.cpp +++ b/src/bootstrap.cpp @@ -49,9 +49,11 @@ auto bootstrap() noexcept -> Container container.bind<ISeedGenerator>().to<SeedGenerator>(); container.bind<IGameFactory>().to_factory( - [&container](const std::shared_ptr<IWindow> &window, - const std::shared_ptr<IScene> &scene, - const std::shared_ptr<ICursorController> &cursor_controller) + [&container]( + const std::shared_ptr<IWindow> &window, + const std::shared_ptr<IScene> &scene, + const std::shared_ptr<ICursorController> &cursor_controller + ) { std::shared_ptr<IStatusLine> statusline = container.get<IStatusLineFactory>()(cursor_controller, window); @@ -62,50 +64,65 @@ auto bootstrap() noexcept -> Container std::shared_ptr<IStatusUpdater> status_updater = container.get<IStatusUpdaterFactory>()(statusline, generation_tracker); - return std::make_unique<Game>(window, scene, cursor_controller, statusline, - generation_tracker, status_updater); - }); + return std::make_unique<Game>( + window, + scene, + cursor_controller, + statusline, + generation_tracker, + status_updater + ); + } + ); container.bind<IRandomNumberGeneratorFactory>().to_factory( [](const uint32_t &seed) { return std::make_unique<RandomNumberGenerator>(seed); - }); + } + ); container.bind<IMatrixFactory<std::string_view>>().to_factory( [](const Bounds &bounds) { return std::make_unique<Matrix<std::string_view>>(bounds); - }); + } + ); container.bind<ISceneFactory>().to_factory( - [&container](const std::shared_ptr<ICursorController> &cursor_controller, - const std::shared_ptr<IWindow> &window) + [&container]( + const std::shared_ptr<ICursorController> &cursor_controller, + const std::shared_ptr<IWindow> &window + ) { auto matrix_factory = container.get<IMatrixFactory<std::string_view>>(); return std::make_unique<Scene>(matrix_factory, cursor_controller, window); - }); + } + ); container.bind<IStatusLineFactory>().to_factory( [](const std::shared_ptr<ICursorController> &cursor_controller, const std::shared_ptr<IWindow> &window) { return std::make_unique<StatusLine>(cursor_controller, window); - }); + } + ); container.bind<IStatusUpdaterFactory>().to_factory( [](const std::shared_ptr<IStatusLine> &statusline, const std::shared_ptr<IGenerationTracker> &generation_tracker) { return std::make_unique<StatusUpdater>(statusline, generation_tracker); - }); + } + ); container.bind<IGenerationTrackerFactory>().to_factory( [](bool is_paused) { return std::make_unique<GenerationTracker>(is_paused); - }); + } + ); return container; } |