More boss fight UI done and a bit of ambient sound working.

This commit is contained in:
Zed A. Shaw 2025-02-28 00:52:48 -05:00
parent 64807174c0
commit a0c0308461
12 changed files with 111 additions and 58 deletions

View file

@ -28,57 +28,26 @@ namespace gui {
}
void OverlayUI::show_sprite(string region, string sprite_name) {
auto ent = $gui.entity(region);
Sprite blood{sprite_name};
auto& cell = $gui.cell_for(ent);
blood.init(cell);
$gui.set<guecs::Sprite>(ent, blood);
$gui.show_sprite(region, sprite_name);
}
void OverlayUI::close_sprite(string region) {
auto ent = $gui.entity(region);
$gui.remove<guecs::Sprite>(ent);
$gui.close<Sprite>(region);
}
void OverlayUI::show_text(string region, string content) {
auto ent = $gui.entity(region);
auto &cell = $gui.cell_for(ent);
Textual text{content, 20};
text.init(cell, $gui.$font);
text.text->setFillColor(ColorValue::LIGHT_MID);
$gui.set<Textual>(ent, text);
}
void OverlayUI::update_text(string region, string content) {
auto ent = $gui.entity(region);
if(auto text = $gui.get_if<Textual>(ent)) {
text->text->setString(content);
}
}
void OverlayUI::update_label(string region, string content) {
auto ent = $gui.entity(region);
if(auto text = $gui.get_if<Label>(ent)) {
text->text->setString(content);
}
$gui.show_text(region, content);
}
void OverlayUI::close_text(string region) {
auto ent = $gui.entity(region);
$gui.remove<Textual>(ent);
$gui.close<Textual>(region);
}
void OverlayUI::show_label(string region, string content) {
auto ent = $gui.entity(region);
auto &cell = $gui.cell_for(ent);
Label text{content, 20};
text.init(cell, $gui.$font);
text.text->setFillColor(ColorValue::LIGHT_MID);
$gui.set<Label>(ent, text);
$gui.show_label(region, content);
}
void OverlayUI::close_label(string region) {
auto ent = $gui.entity(region);
$gui.remove<Label>(ent);
$gui.close<Label>(region);
}
}