Even better API, but still not the best organization. This will let me implement both sides, then I can pull it out and try to generalize it into a few guecs components.
This commit is contained in:
parent
3e0adf0c22
commit
4b0d76bbcc
7 changed files with 63 additions and 22 deletions
16
gui/fsm.cpp
16
gui/fsm.cpp
|
@ -135,12 +135,9 @@ namespace gui {
|
|||
case LOOT_SELECT: {
|
||||
$grab_source = std::any_cast<DinkyECS::Entity>(data);
|
||||
|
||||
if(auto world_entity = $loot_ui.start_grab(*$grab_source)) {
|
||||
auto& source = $loot_ui.get_grab_source(*$grab_source);
|
||||
source.grab($window);
|
||||
source.move($router.position);
|
||||
|
||||
$status_ui.start_drop(*world_entity);
|
||||
if(auto world_entity = $loot_ui.begin_grab(*$grab_source)) {
|
||||
$window.setMouseCursorVisible(false);
|
||||
$status_ui.begin_drop(*world_entity);
|
||||
} else {
|
||||
// BUG: need a cancel operation here
|
||||
$window.setMouseCursorVisible(true);
|
||||
|
@ -149,11 +146,10 @@ namespace gui {
|
|||
} break;
|
||||
case INV_SELECT: {
|
||||
auto gui_id = std::any_cast<DinkyECS::Entity>(data);
|
||||
if($grab_source) {
|
||||
auto& drop = $status_ui.get_drop_target(gui_id);
|
||||
|
||||
if(drop.commit()) {
|
||||
$loot_ui.commit_drop(*$grab_source);
|
||||
if($grab_source) {
|
||||
if($status_ui.commit_drop(gui_id)) {
|
||||
$loot_ui.commit_grab(*$grab_source);
|
||||
$grab_source = std::nullopt;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue