Optimize GUECS a bit so that it automatically sets up the cell names and lel::Cell contents in the world, making it easier to work with.
This commit is contained in:
parent
2261e6f418
commit
389690e5c3
5 changed files with 7 additions and 11 deletions
|
@ -23,14 +23,12 @@ namespace gui {
|
|||
for(auto& [name, cell] : $gui.cells()) {
|
||||
if(name.starts_with("button_")) {
|
||||
auto button = $gui.entity(name);
|
||||
world.set<lel::Cell>(button, cell);
|
||||
world.set<Rectangle>(button, {});
|
||||
world.set<Clickable>(button,
|
||||
guecs::make_action(*$level.world, Events::GUI::ATTACK));
|
||||
world.set<Label>(button, {"Attack"});
|
||||
} else if(name.starts_with("bar_")) {
|
||||
$meter = $gui.entity(name);
|
||||
world.set<lel::Cell>($meter, cell);
|
||||
world.set<Rectangle>($meter, {});
|
||||
world.set<Meter>($meter, {});
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue