Better meaning API on both sides for the drag-n-drop operations, but I _swear_ there's a way to do this in the GrabSource/DropTarget instead.

This commit is contained in:
Zed A. Shaw 2025-06-08 23:27:43 -04:00
parent 47c219b86e
commit 3e0adf0c22
6 changed files with 26 additions and 23 deletions

View file

@ -46,7 +46,7 @@ namespace gui {
guecs::make_action(*$level.world, Events::GUI::INV_SELECT, {button})
});
$gui.set<DropTarget>(button, {
[&, button]() -> bool { return place_slot(button); }
.commit=[&, button]() -> bool { return place_slot(button); }
});
}
}
@ -83,7 +83,7 @@ namespace gui {
init();
}
void StatusUI::select_slot(DinkyECS::Entity entity) {
void StatusUI::start_drop(DinkyECS::Entity entity) {
$selected_entity = entity;
}
@ -99,4 +99,8 @@ namespace gui {
return false;
}
}
guecs::DropTarget& StatusUI::get_drop_target(DinkyECS::Entity gui_id) {
return $gui.get<guecs::DropTarget>(gui_id);
}
}