Fix up the backend so it has sane names like get_sprite and get_icon, then implemented a guecs::Icon for icons. Those don't scale and typically have other properties different from a Sprite.

This commit is contained in:
Zed A. Shaw 2025-07-22 12:59:10 -04:00
parent 31a02505aa
commit 5a7c096b52
9 changed files with 76 additions and 29 deletions

View file

@ -93,6 +93,10 @@ namespace guecs {
query<lel::Cell, Sprite>([&](auto, auto &cell, auto &sprite) {
sprite.init(cell);
});
query<lel::Cell, Icon>([&](auto, auto &cell, auto &icon) {
icon.init(cell);
});
}
void UI::debug_layout(sf::RenderWindow& window) {
@ -138,6 +142,11 @@ namespace guecs {
sprite.render(window, shader_ptr);
});
query<Icon>([&](auto ent, auto& icon) {
auto shader_ptr = find_shader(ent, false);
icon.render(window, shader_ptr);
});
query<Label>([&](auto ent, auto& text) {
auto shader_ptr = find_shader(ent, false);
text.render(window, shader_ptr);