Move now works better, and the API is a lot cleaner. Now just need to make it not crash.

This commit is contained in:
Zed A. Shaw 2025-06-10 11:12:04 -04:00
parent be7b86a913
commit e01e697535
5 changed files with 26 additions and 15 deletions

View file

@ -67,8 +67,11 @@ namespace gui {
"item in inventory UI doesn't exist in world. New level?");
auto& sprite = $level.world->get<components::Sprite>(item);
$gui.set_init<guecs::Sprite>(id, {sprite.name});
$gui.set<guecs::GrabSource>(id, {
item, [&, id]() { return remove_slot(id); }});
guecs::GrabSource grabber{
item, [&, id]() { return remove_slot(id); }};
grabber.setSprite($gui, id);
$gui.set<guecs::GrabSource>(id, grabber);
} else {
$gui.set<guecs::DropTarget>(id, {
[&, id](DinkyECS::Entity world_entity) -> bool { return place_slot(id, world_entity); }