Inventory system basically works now but is in a alpha hack stage. Time to refactor.
This commit is contained in:
parent
b7f49aa719
commit
e0e7a1027c
11 changed files with 92 additions and 33 deletions
12
guecs.cpp
12
guecs.cpp
|
@ -103,15 +103,19 @@ namespace guecs {
|
|||
if((x >= cell.x && x <= cell.x + cell.w) &&
|
||||
(y >= cell.y && y <= cell.y + cell.h))
|
||||
{
|
||||
auto& cn = $world.get<CellName>(ent);
|
||||
clicked.action(ent, cn.name);
|
||||
if(auto action_data = get_if<ActionData>(ent)) {
|
||||
clicked.action(ent, action_data->data);
|
||||
} else {
|
||||
clicked.action(ent, {});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Clickable make_action(DinkyECS::World& target, Events::GUI event) {
|
||||
return {[&, event](auto ent, auto&){
|
||||
target.send<Events::GUI>(event, ent, {});
|
||||
return {[&, event](auto ent, auto data){
|
||||
// remember that ent is passed in from the UI::mouse handler
|
||||
target.send<Events::GUI>(event, ent, data);
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue