Added a Background guecs component.
This commit is contained in:
parent
69a810b5a1
commit
3a6ba8445a
7 changed files with 78 additions and 56 deletions
14
guecs.cpp
14
guecs.cpp
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue