aboutsummaryrefslogtreecommitdiff
path: root/src/bootstrap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap.cpp')
-rw-r--r--src/bootstrap.cpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/src/bootstrap.cpp b/src/bootstrap.cpp
index 713991d..8dec609 100644
--- a/src/bootstrap.cpp
+++ b/src/bootstrap.cpp
@@ -5,10 +5,13 @@
#include "interfaces/cursor.hpp"
#include "interfaces/engine.hpp"
#include "interfaces/game.hpp"
+#include "interfaces/generation_tracker.hpp"
#include "interfaces/input.hpp"
#include "interfaces/matrix.hpp"
#include "interfaces/randomization.hpp"
#include "interfaces/scene.hpp"
+#include "interfaces/status_updater.hpp"
+#include "interfaces/statusline.hpp"
#include "interfaces/window.hpp"
// Implementations
@@ -22,6 +25,9 @@
#include "engine/user/cursor.hpp"
#include "engine/user/input.hpp"
#include "game/game.hpp"
+#include "game/generation_tracker.hpp"
+#include "game/status_updater.hpp"
+#include "game/statusline.hpp"
#include "randomization/generator.hpp"
#include "randomization/seed_generator.hpp"
@@ -42,11 +48,21 @@ Container bootstrap() noexcept
container.bind<IWindow>().to<Window>();
container.bind<IGameFactory>().to_factory(normalize_lambda(
- [](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)
{
+ auto statusline =
+ container.get<IStatusLineFactory>()(cursor_controller, window);
+
+ auto generation_tracker = container.get<IGenerationTrackerFactory>()(true);
+
+ auto status_updater =
+ container.get<IStatusUpdaterFactory>()(statusline, generation_tracker);
+
return std::dynamic_pointer_cast<IGame>(
- std::make_shared<Game>(window, scene, cursor_controller));
+ std::make_shared<Game>(window, scene, cursor_controller, statusline,
+ generation_tracker, status_updater));
}));
container.bind<IRandomNumberGeneratorFactory>().to_factory(
@@ -79,5 +95,28 @@ Container bootstrap() noexcept
cursor_controller, window));
}));
+ container.bind<IStatusLineFactory>().to_factory(
+ [](const std::shared_ptr<ICursorController> &cursor_controller,
+ const std::shared_ptr<IWindow> &window)
+ {
+ return std::dynamic_pointer_cast<IStatusLine>(
+ std::make_shared<StatusLine>(cursor_controller, window));
+ });
+
+ container.bind<IStatusUpdaterFactory>().to_factory(
+ [](const std::shared_ptr<IStatusLine> &status_line,
+ const std::shared_ptr<IGenerationTracker> &generation_tracker)
+ {
+ return std::dynamic_pointer_cast<IStatusUpdater>(
+ std::make_shared<StatusUpdater>(status_line, generation_tracker));
+ });
+
+ container.bind<IGenerationTrackerFactory>().to_factory(
+ [](bool is_paused)
+ {
+ return std::dynamic_pointer_cast<IGenerationTracker>(
+ std::make_shared<GenerationTracker>(is_paused));
+ });
+
return container;
}