summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}