Drag now show the icon while you're dragging, so now need to work out all of the edge cases for each action.
This commit is contained in:
parent
ca74b817e5
commit
029a0f86ae
3 changed files with 19 additions and 1 deletions
|
@ -115,6 +115,8 @@ namespace gui {
|
|||
if(UISystem::loot_drop($loot_ui.$gui,
|
||||
$status_ui.$gui, $grab_source, data))
|
||||
{
|
||||
$grab_source = std::nullopt;
|
||||
$grab_sprite = nullptr;
|
||||
state(DNDState::END);
|
||||
}
|
||||
break;
|
||||
|
@ -134,11 +136,19 @@ namespace gui {
|
|||
// NOTE: if > 1 items, go to LOOT_OPEN instead
|
||||
auto gui_id = $loot_ui.$gui.entity("item_0");
|
||||
$grab_source = UISystem::loot_grab($loot_ui.$gui, gui_id);
|
||||
if($grab_source) state(DNDState::ITEM_PICKUP);
|
||||
|
||||
if($grab_source) {
|
||||
auto& source = $loot_ui.$gui.get<guecs::GrabSource>(*$grab_source);
|
||||
$grab_sprite = source.sprite;
|
||||
// call this once to properly position the sprite
|
||||
handle_mouse(Event::MOUSE_MOVE, $loot_ui.$gui);
|
||||
state(DNDState::ITEM_PICKUP);
|
||||
}
|
||||
} break;
|
||||
case LOOT_OPEN:
|
||||
$loot_ui.active = true;
|
||||
$grab_source = std::nullopt;
|
||||
$grab_sprite = nullptr;
|
||||
state(DNDState::LOOTING);
|
||||
break;
|
||||
default:
|
||||
|
@ -183,4 +193,9 @@ namespace gui {
|
|||
}
|
||||
}
|
||||
|
||||
void DNDLoot::render() {
|
||||
if($grab_source && $grab_sprite) {
|
||||
$window.draw(*$grab_sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue