aboutsummaryrefslogtreecommitdiff
path: root/src/game/status_updater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/status_updater.cpp')
-rw-r--r--src/game/status_updater.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/game/status_updater.cpp b/src/game/status_updater.cpp
new file mode 100644
index 0000000..18c535e
--- /dev/null
+++ b/src/game/status_updater.cpp
@@ -0,0 +1,25 @@
+#include "status_updater.hpp"
+
+#include <fmt/core.h>
+#include <utility>
+
+StatusUpdater::StatusUpdater(
+ std::shared_ptr<IStatusLine> statusline,
+ std::shared_ptr<IGenerationTracker> generation_tracker) noexcept
+ : _statusline(std::move(statusline)),
+ _generation_tracker(std::move(generation_tracker))
+{
+}
+
+void StatusUpdater::update(const Vector2 &context) noexcept
+{
+ _statusline->set_status(
+ StatusLineSection::A,
+ fmt::format("X: {} Y {}", context.get_x(), context.get_y()));
+
+ _statusline->set_status(
+ StatusLineSection::B,
+ fmt::format("Paused: {} Generation: {}",
+ _generation_tracker->get_is_paused() ? "yes" : "no",
+ _generation_tracker->get_current_generation()));
+}