Better design that has a render/update cycle for components.
This commit is contained in:
parent
48b672eec4
commit
2dbfac27c6
5 changed files with 38 additions and 21 deletions
|
|
@ -80,11 +80,7 @@ namespace guecs {
|
|||
});
|
||||
|
||||
query<lel::Cell, Meter>([this](auto ent, auto &cell, auto& meter) {
|
||||
if(auto bg = get_if<Rectangle>(ent)) {
|
||||
meter.init(cell, *bg);
|
||||
} else {
|
||||
meter.init(cell);
|
||||
}
|
||||
meter.init(cell);
|
||||
});
|
||||
|
||||
query<lel::Cell, Text>([this](auto, auto& cell, auto& text) {
|
||||
|
|
@ -119,6 +115,16 @@ namespace guecs {
|
|||
}
|
||||
}
|
||||
|
||||
void UI::update() {
|
||||
query<Rectangle>([&](auto ent, auto& rect) {
|
||||
rect.update();
|
||||
});
|
||||
|
||||
query<Meter>([&](auto ent, auto &meter) {
|
||||
meter.update();
|
||||
});
|
||||
}
|
||||
|
||||
// BUG: either render detects that the things are initialized or there's
|
||||
// another validator function I can call in debug modes to confirm they are
|
||||
void UI::render(sf::RenderTarget& window) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue