Now have a body damage UI to show damage to each body part.

This commit is contained in:
Zed A. Shaw 2026-03-29 14:43:05 -04:00
parent 36a49ef768
commit ae0d205037
5 changed files with 81 additions and 10 deletions

View file

@ -16,13 +16,8 @@ namespace gui {
{
$gui.position(x, y, width, height);
$gui.layout(
"[=body_head]"
"[=body_chest]"
"[=body_right_arm]"
"[=body_left_arm]"
"[=body_stomach]"
"[=body_left_leg]"
"[=body_right_leg]"
"[*%(100, 200)body_ui]"
"[_]"
"[=inv0|=inv1|=inv2]"
"[=inv3|=inv4|=inv5]"
"[=inv6|=inv7|=inv8]"
@ -36,11 +31,11 @@ namespace gui {
for(auto& [name, cell] : $gui.cells()) {
auto gui_id = $gui.entity(name);
$gui.set<Text>(gui_id, {guecs::to_wstring(name)});
if(name.starts_with("body_")) {
$gui.set<Meter>(gui_id, {});
auto& cell = $gui.cell_for(name);
$body_ui.init(cell.x, cell.y, cell.w, cell.h);
} else {
$gui.set<Rectangle>(gui_id, {});
$gui.set<Clickable>(gui_id, {
@ -67,6 +62,8 @@ namespace gui {
auto player = world->get_the<components::Player>();
auto& inventory = world->get<inventory::Model>(player.entity);
$body_ui.update();
for(const auto& [slot, cell] : $gui.cells()) {
if(inventory.has(slot)) {
@ -92,6 +89,7 @@ namespace gui {
void StatusUI::render(sf::RenderWindow &window) {
$gui.render(window);
$body_ui.render(window);
// $gui.debug_layout(window);
}