Now overlay UI can show some text pretty easily and is showing the debug stats.

This commit is contained in:
Zed A. Shaw 2025-02-20 10:53:01 -05:00
parent d8e1fc7aa3
commit 30a7e1b2cc
5 changed files with 51 additions and 21 deletions

View file

@ -45,4 +45,24 @@ namespace gui {
$gui.remove<guecs::Sprite>(middle);
}
}
void OverlayUI::init_stats() {
auto top_left = $gui.entity("top_left");
auto &cell = $gui.cell_for(top_left);
Textual text{"", 20};
text.init(cell, $gui.$font);
text.text->setFillColor(ColorValue::LIGHT_MID);
$gui.set<Textual>(top_left, text);
}
void OverlayUI::draw_stats(std::string stats) {
auto top_left = $gui.entity("top_left");
auto& text = $gui.get<Textual>(top_left);
text.text->setString(stats);
}
void OverlayUI::close_stats() {
auto top_left = $gui.entity("top_left");
$gui.remove<Textual>(top_left);
}
}