aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-06-12 15:00:52 +0200
committerHampusM <hampus@hampusmat.com>2022-06-13 17:57:02 +0200
commit5d00b67cace42eb87ba7f818fb5fccc30e9fd667 (patch)
tree83ddd78169f87050f7e46e2b1e74ebf10bdc5132 /src
parent2607f946da1b56bcb5bf9534e0122c8fe05c4469 (diff)
refactor: move set section lengths to game
Diffstat (limited to 'src')
-rw-r--r--src/game/game.cpp18
-rw-r--r--src/game/status_manager.cpp9
2 files changed, 18 insertions, 9 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 4b63c5a..ad95bd4 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -49,6 +49,24 @@ void Game::on_start() noexcept
std::shared_ptr<IStatusLine> statusline =
_statusline_factory(Bounds({.width = scene_size.get_width(), .height = 1}));
+ const auto statusline_section_a_length = 5;
+ const auto statusline_section_b_length = 15;
+ const auto statusline_section_c_length = 15;
+ const auto statusline_section_d_length = 20;
+ const auto statusline_section_e_length = 25;
+ const auto statusline_section_f_length = 30;
+ const auto statusline_section_g_length = 30;
+ const auto statusline_section_h_length = 20;
+
+ statusline->set_section_length(StatusLineSection::A, statusline_section_a_length);
+ statusline->set_section_length(StatusLineSection::B, statusline_section_b_length);
+ statusline->set_section_length(StatusLineSection::C, statusline_section_c_length);
+ statusline->set_section_length(StatusLineSection::D, statusline_section_d_length);
+ statusline->set_section_length(StatusLineSection::E, statusline_section_e_length);
+ statusline->set_section_length(StatusLineSection::F, statusline_section_f_length);
+ statusline->set_section_length(StatusLineSection::G, statusline_section_g_length);
+ statusline->set_section_length(StatusLineSection::H, statusline_section_h_length);
+
_scene->register_component(statusline, Vector2({.x = 0, .y = 1}));
_status_manager->bind(statusline);
diff --git a/src/game/status_manager.cpp b/src/game/status_manager.cpp
index b30bd82..36add4c 100644
--- a/src/game/status_manager.cpp
+++ b/src/game/status_manager.cpp
@@ -7,15 +7,6 @@
void StatusManager::bind(const std::shared_ptr<IStatusLine> &statusline) noexcept
{
_statusline = statusline;
-
- _statusline->set_section_length(StatusLineSection::A, 5);
- _statusline->set_section_length(StatusLineSection::B, 15);
- _statusline->set_section_length(StatusLineSection::C, 15);
- _statusline->set_section_length(StatusLineSection::D, 20);
- _statusline->set_section_length(StatusLineSection::E, 25);
- _statusline->set_section_length(StatusLineSection::F, 30);
- _statusline->set_section_length(StatusLineSection::G, 30);
- _statusline->set_section_length(StatusLineSection::H, 20);
}
void StatusManager::set_section_title(