aboutsummaryrefslogtreecommitdiff
path: root/src/game/status_updater.cpp
blob: 1cfd1d25d7c0229993066d4c95fd063990f15144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#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()
		)
	);
}