aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bootstrap.cpp1
-rw-r--r--src/game/game.cpp4
-rw-r--r--src/game/game.hpp3
-rw-r--r--src/game/status_manager.cpp6
-rw-r--r--src/game/status_manager.hpp2
-rw-r--r--src/interfaces/status_manager.hpp2
6 files changed, 11 insertions, 7 deletions
diff --git a/src/bootstrap.cpp b/src/bootstrap.cpp
index 2e687ed..14aa922 100644
--- a/src/bootstrap.cpp
+++ b/src/bootstrap.cpp
@@ -69,7 +69,6 @@ auto bootstrap() noexcept -> yacppdic::Container
return std::make_unique<Game>(
scene,
cursor_controller,
- statusline,
generation_tracker,
status_manager,
vector2_statusline_subscriber_adapter_factory);
diff --git a/src/game/game.cpp b/src/game/game.cpp
index d642f7c..18db133 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -13,14 +13,12 @@
Game::Game(
std::shared_ptr<IScene> scene,
std::shared_ptr<ICursorController> cursor_controller,
- std::shared_ptr<IStatusLine> statusline,
std::shared_ptr<IGenerationTracker> generation_tracker,
std::shared_ptr<IStatusManager> status_manager,
IStatusLineSubscriberAdapterFactory<Vector2>
vector2_statusline_subscriber_adapter_factory) noexcept
: _scene(std::move(scene)),
_cursor_controller(std::move(cursor_controller)),
- _statusline(std::move(statusline)),
_generation_tracker(std::move(generation_tracker)),
_status_manager(std::move(status_manager)),
_vector2_statusline_subscriber_adapter_factory(
@@ -30,7 +28,7 @@ Game::Game(
void Game::on_start() noexcept
{
- _statusline->initialize_background();
+ _status_manager->initialize();
_status_manager->set_section_title(StatusLineSection::A, "");
_status_manager->set_section_title(StatusLineSection::B, "X: ");
diff --git a/src/game/game.hpp b/src/game/game.hpp
index c765312..1546a9c 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -5,7 +5,6 @@
#include "interfaces/generation_tracker.hpp"
#include "interfaces/scene.hpp"
#include "interfaces/status_manager.hpp"
-#include "interfaces/statusline.hpp"
#include "interfaces/statusline_subscriber_adapter.hpp"
#include <memory>
@@ -16,7 +15,6 @@ public:
Game(
std::shared_ptr<IScene> scene,
std::shared_ptr<ICursorController> cursor_controller,
- std::shared_ptr<IStatusLine> statusline,
std::shared_ptr<IGenerationTracker> generation_tracker,
std::shared_ptr<IStatusManager> status_manager,
IStatusLineSubscriberAdapterFactory<Vector2>
@@ -34,7 +32,6 @@ public:
private:
std::shared_ptr<IScene> _scene;
std::shared_ptr<ICursorController> _cursor_controller;
- std::shared_ptr<IStatusLine> _statusline;
std::shared_ptr<IGenerationTracker> _generation_tracker;
std::shared_ptr<IStatusManager> _status_manager;
IStatusLineSubscriberAdapterFactory<Vector2>
diff --git a/src/game/status_manager.cpp b/src/game/status_manager.cpp
index 927f645..1a709d3 100644
--- a/src/game/status_manager.cpp
+++ b/src/game/status_manager.cpp
@@ -8,12 +8,18 @@ StatusManager::StatusManager(std::shared_ptr<IStatusLine> statusline) noexcept
: _statusline(std::move(statusline))
{
+}
+
+void StatusManager::initialize() noexcept
+{
_statusline->set_section_length(StatusLineSection::A, 5U);
_statusline->set_section_length(StatusLineSection::B, 15U);
_statusline->set_section_length(StatusLineSection::C, 15U);
_statusline->set_section_length(StatusLineSection::D, 20U);
_statusline->set_section_length(StatusLineSection::E, 15U);
_statusline->set_section_length(StatusLineSection::F, 15U);
+
+ _statusline->initialize_background();
}
void StatusManager::set_section_title(
diff --git a/src/game/status_manager.hpp b/src/game/status_manager.hpp
index cdc9de5..ea61ff8 100644
--- a/src/game/status_manager.hpp
+++ b/src/game/status_manager.hpp
@@ -15,6 +15,8 @@ class StatusManager : public IStatusManager
public:
explicit StatusManager(std::shared_ptr<IStatusLine> statusline) noexcept;
+ void initialize() noexcept override;
+
void set_section_title(
const StatusLineSection &section,
const std::string_view &title) noexcept override;
diff --git a/src/interfaces/status_manager.hpp b/src/interfaces/status_manager.hpp
index 94464f0..18d6928 100644
--- a/src/interfaces/status_manager.hpp
+++ b/src/interfaces/status_manager.hpp
@@ -13,6 +13,8 @@ class IStatusManager
public:
virtual ~IStatusManager() = default;
+ virtual void initialize() noexcept = 0;
+
virtual void set_section_title(
const StatusLineSection &section,
const std::string_view &title) noexcept = 0;