diff options
author | HampusM <hampus@hampusmat.com> | 2022-06-08 16:06:03 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:57:01 +0200 |
commit | 3f9004b598fc8006576db9b8d2ae4e080101101b (patch) | |
tree | 97108db2a08253417139bd76741add2dd126f58d /src/bootstrap.cpp | |
parent | 2d9661790db30eb169d07d36b485943c598253b9 (diff) |
refactor: give game responsibility of statusline
Diffstat (limited to 'src/bootstrap.cpp')
-rw-r--r-- | src/bootstrap.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/bootstrap.cpp b/src/bootstrap.cpp index 44ef211..e651512 100644 --- a/src/bootstrap.cpp +++ b/src/bootstrap.cpp @@ -29,12 +29,7 @@ #include "game/generation_tracker.hpp" #include "game/status_manager.hpp" -#include <fmt/core.h> - #include <memory> -#include <string> -#include <string_view> -#include <vector> auto bootstrap() noexcept -> yacppdic::Container { @@ -43,6 +38,7 @@ auto bootstrap() noexcept -> yacppdic::Container container.bind<IUserInputObserver>().to<UserInputObserver>(); container.bind<ICursorController>().to<CursorController>(); container.bind<ICLIGameEngine>().to<CLIGameEngine>(); + container.bind<IStatusManager>().to<StatusManager>(); container.bind<IGameFactory>().to_factory( [&container]( @@ -50,11 +46,10 @@ auto bootstrap() noexcept -> yacppdic::Container const std::shared_ptr<ICursorController> &cursor_controller, const std::shared_ptr<IUserInputObserver> &user_input_observer) { - std::shared_ptr<IStatusLine> statusline = container.get<IStatusLineFactory>()( - Bounds({.width = scene->size().get_width(), .height = 1})); + const auto statusline_factory = container.get<IStatusLineFactory>(); std::shared_ptr<IStatusManager> status_manager = - container.get<IStatusManagerFactory>()(statusline); + container.get<IStatusManager>(); std::shared_ptr<IGenerationTracker> generation_tracker = container.get<IGenerationTrackerFactory>()(true); @@ -62,6 +57,7 @@ auto bootstrap() noexcept -> yacppdic::Container const auto cell_helper_factory = container.get<ICellHelperFactory<char>>(); return std::make_unique<Game>( + statusline_factory, scene, cursor_controller, generation_tracker, @@ -93,12 +89,6 @@ auto bootstrap() noexcept -> yacppdic::Container return std::make_unique<StatusLine>(matrix_factory(size)); }); - container.bind<IStatusManagerFactory>().to_factory( - [](const std::shared_ptr<IStatusLine> &statusline) - { - return std::make_unique<StatusManager>(statusline); - }); - container.bind<IGenerationTrackerFactory>().to_factory( [](bool is_paused) { |