From 486ca3846b46dc229e5807968578809766ec1991 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 23 Mar 2022 19:41:31 +0100 Subject: feat: implement generations & multithreading --- src/game/status_updater.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/game/status_updater.cpp (limited to 'src/game/status_updater.cpp') 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 +#include + +StatusUpdater::StatusUpdater( + std::shared_ptr statusline, + std::shared_ptr 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())); +} -- cgit v1.2.3-18-g5258