summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-11-20 22:42:23 +0100
committerAki <please@ignore.pl>2022-11-20 22:42:23 +0100
commitc2ecf09c29bc1d06336f372621ba37eba5f9875b (patch)
tree4f2ecfa203ffa0aec7561e3e6866e57201efa82f
parent181ad14d537d75a97a8d830d70f7d9486f26ee1d (diff)
downloadkurator-c2ecf09c29bc1d06336f372621ba37eba5f9875b.zip
kurator-c2ecf09c29bc1d06336f372621ba37eba5f9875b.tar.gz
kurator-c2ecf09c29bc1d06336f372621ba37eba5f9875b.tar.bz2
Added force balance slide
-rw-r--r--kurator/src/Battle.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp
index cb97ce7..08cc6dc 100644
--- a/kurator/src/Battle.cpp
+++ b/kurator/src/Battle.cpp
@@ -89,6 +89,18 @@ Battle::draw() const
const int y = height/2 + transform.position.y*scale - text.font_size/2;
DrawText(text.text.c_str(), x, y, text.font_size, text.color);
}
+ auto points = registry.view<battles::HitPoints, battles::Team>();
+ double totals[2] {0.0, 0.0}; // FIXME and extract
+ for (const auto& [entity, points, team] : points.each()) {
+ if (team.id < 2)
+ totals[team.id] += points.health;
+ }
+ const int x1 = width / 4.0;
+ const int w1 = width / 2.0 * totals[1] / (totals[0] + totals[1]);
+ const int x2 = x1 + w1;
+ const int w2 = width / 2.0 * totals[0] / (totals[0] + totals[1]);
+ DrawRectangle(x1, 10, w1, 10, GREEN);
+ DrawRectangle(x2, 10, w2, 10, RED);
}