Added a Background guecs component.

This commit is contained in:
Zed A. Shaw 2025-02-18 23:08:04 -05:00
parent 69a810b5a1
commit 3a6ba8445a
7 changed files with 78 additions and 56 deletions

View file

@ -22,6 +22,15 @@ namespace guecs {
}
void UI::init(TexturePack& textures) {
if($world.has_the<Background>()) {
auto& bg = $world.get_the<Background>();
bg.init();
}
$world.query<Background>([](auto, auto& bg) {
bg.init();
});
$world.query<lel::Cell, Rectangle>([](auto, auto& cell, auto& rect) {
rect.init(cell);
});
@ -49,6 +58,11 @@ namespace guecs {
}
void UI::render(sf::RenderWindow& window) {
if($world.has_the<Background>()) {
auto& bg = $world.get_the<Background>();
window.draw(*bg.shape);
}
$world.query<Rectangle>([&](auto, auto& rect) {
window.draw(*rect.shape);
});