Have a few basic monochrome test items and the first little leather pouches on the 'tool belt'.

This commit is contained in:
Zed A. Shaw 2025-03-23 11:34:50 -04:00
parent d7ff7d6acf
commit 5af9a6664e
27 changed files with 41 additions and 28 deletions

View file

@ -11,29 +11,20 @@ namespace gui {
{
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
$gui.layout(
"[*%(100,150)button_attack1 | *%(100,150)button_attack2 | *%(100,150)button_attack3 | *%(100,150)button_heal]"
"[ >.%(100,50)label_hp | *%.(198,50)bar_hp | _ ]");
"[*%(100,150)button_attack1 | *%(100,150)button_attack2 | *%(100,150)button_attack3 | *%(100,150)button_heal]");
}
void CombatUI::init() {
auto& world = $gui.world();
world.set_the<Background>({$gui.$parser});
world.set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
for(auto& [name, cell] : $gui.cells()) {
if(name.starts_with("button_")) {
auto button = $gui.entity(name);
world.set<Rectangle>(button, {});
world.set<Sprite>(button, {"leather_pouch-128"});
world.set<Clickable>(button,
guecs::make_action(*$level.world, Events::GUI::ATTACK));
world.set<Label>(button, {"Attack"});
} else if(name.starts_with("bar_")) {
$meter = $gui.entity(name);
world.set<Rectangle>($meter, {});
world.set<Meter>($meter, {});
} else {
// ignored, it's just space
$gui.entity(name);
}
}
@ -46,9 +37,7 @@ namespace gui {
$gui.render(window);
}
void CombatUI::set_damage(float percent) {
auto& meter = $gui.world().get<Meter>($meter);
meter.percent = percent;
void CombatUI::set_damage(float) {
}
void CombatUI::update_level(GameLevel &level) {