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:
parent
47c219b86e
commit
3e0adf0c22
6 changed files with 26 additions and 23 deletions
|
@ -46,7 +46,7 @@ namespace gui {
|
|||
update();
|
||||
}
|
||||
|
||||
std::optional<DinkyECS::Entity> LootUI::select_slot(DinkyECS::Entity slot_id) {
|
||||
std::optional<DinkyECS::Entity> LootUI::start_grab(DinkyECS::Entity slot_id) {
|
||||
if(contents.contains(slot_id)) {
|
||||
return contents.at(slot_id);
|
||||
} else {
|
||||
|
@ -54,7 +54,7 @@ namespace gui {
|
|||
}
|
||||
}
|
||||
|
||||
void LootUI::remove_slot(DinkyECS::Entity slot_id) {
|
||||
void LootUI::commit_drop(DinkyECS::Entity slot_id) {
|
||||
contents.erase(slot_id);
|
||||
update();
|
||||
}
|
||||
|
@ -80,12 +80,12 @@ namespace gui {
|
|||
}
|
||||
}
|
||||
|
||||
bool LootUI::has_grabber(DinkyECS::Entity gui_id) {
|
||||
bool LootUI::has_grab_source(DinkyECS::Entity gui_id) {
|
||||
return $gui.has<guecs::Sprite>(gui_id);
|
||||
}
|
||||
|
||||
guecs::GrabSource& LootUI::get_grabber(DinkyECS::Entity gui_id) {
|
||||
dbc::check(has_grabber(gui_id), "invalid GrabSource requested, entity isn't in the GUI.");
|
||||
guecs::GrabSource& LootUI::get_grab_source(DinkyECS::Entity gui_id) {
|
||||
dbc::check(has_grab_source(gui_id), "invalid GrabSource requested, entity isn't in the GUI.");
|
||||
|
||||
return static_cast<guecs::GrabSource&>($gui.get<guecs::Sprite>(gui_id));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue