Can now drag an item out of inventory and drop on the ground, then pick it back up, and put it in a loot container, and then back again. Still buggy but working for now.

This commit is contained in:
Zed A. Shaw 2025-06-19 00:45:22 -04:00
parent 68e50342e5
commit 119b3ed11d
7 changed files with 58 additions and 6 deletions

View file

@ -4,6 +4,7 @@
#include "rand.hpp"
#include <fmt/xchar.h>
#include "gui/guecstra.hpp"
#include "systems.hpp"
namespace gui {
using namespace guecs;
@ -85,7 +86,7 @@ namespace gui {
init();
}
bool StatusUI::place_slot(DinkyECS::Entity gui_id, DinkyECS::Entity world_entity) {
bool StatusUI::place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity) {
if($level.world->has<components::Sprite>(world_entity)) {
auto& sprite = $level.world->get<components::Sprite>(world_entity);
$gui.set_init<guecs::Sprite>(gui_id, {sprite.name});
@ -101,7 +102,11 @@ namespace gui {
}
}
void StatusUI::remove_slot(DinkyECS::Entity slot_id) {
bool StatusUI::drop_item(DinkyECS::Entity item_id) {
return System::drop_item($level, item_id);
}
void StatusUI::remove_slot(guecs::Entity slot_id) {
if(contents.contains(slot_id)) {
contents.erase(slot_id);
$gui.remove<guecs::GrabSource>(slot_id);