diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-23 19:41:31 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:57 +0200 |
commit | 486ca3846b46dc229e5807968578809766ec1991 (patch) | |
tree | 65a4b7a746d6305666af06f8a1975c76244085a7 /src/game/status_updater.cpp | |
parent | b8e86ce397dc07320c02f6a5f592c7c6a4421c86 (diff) |
feat: implement generations & multithreading
Diffstat (limited to 'src/game/status_updater.cpp')
-rw-r--r-- | src/game/status_updater.cpp | 25 |
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())); +} |