You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
668 B
25 lines
668 B
#include "gui/uisystems.hpp"
|
|
#include "gui/guecstra.hpp"
|
|
|
|
namespace UISystem {
|
|
std::optional<guecs::Entity> loot_grab(guecs::UI& gui, guecs::Entity gui_id) {
|
|
if(auto source = gui.get_if<guecs::GrabSource>(gui_id)) {
|
|
source->grab();
|
|
return gui_id;
|
|
} else {
|
|
return std::nullopt;
|
|
}
|
|
}
|
|
|
|
bool loot_drop(guecs::UI& source, guecs::UI& target, guecs::Entity source_id, guecs::Entity target_id) {
|
|
auto& drop = target.get<guecs::DropTarget>(target_id);
|
|
auto& grab = source.get<guecs::GrabSource>(source_id);
|
|
|
|
if(drop.commit(grab.world_entity)) {
|
|
grab.commit();
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|