I have the overlay display the low health blood using the gui system.

This commit is contained in:
Zed A. Shaw 2025-02-20 08:41:45 -05:00
parent 70a9420c11
commit d8e1fc7aa3
5 changed files with 50 additions and 24 deletions

View file

@ -15,9 +15,17 @@ namespace guecs {
}
DinkyECS::Entity UI::entity(std::string name) {
auto entity = $world.entity();
$world.set<CellName>(entity, {name});
return entity;
if($name_ents.contains(name)) {
// already exists so just return it
return $name_ents.at(name);
} else {
auto entity = $world.entity();
// this lets you look up an entity by name
$name_ents.insert_or_assign(name, entity);
// this makes it easier to get the name during querying
$world.set<CellName>(entity, {name});
return entity;
}
}
void UI::init(TexturePack& textures) {