Big BIG refactor to make inventory use a model that's placed into the world, following a more sane MVC style.

This commit is contained in:
Zed A. Shaw 2025-06-20 13:17:12 -04:00
parent 119b3ed11d
commit a0eff927b6
21 changed files with 270 additions and 123 deletions

View file

@ -5,6 +5,7 @@
#include <SFML/Graphics/Font.hpp>
#include <guecs/ui.hpp>
#include "events.hpp"
#include "inventory.hpp"
namespace gui {
class LootUI {
@ -12,7 +13,9 @@ namespace gui {
bool active = false;
guecs::UI $gui;
GameLevel $level;
std::unordered_map<DinkyECS::Entity, DinkyECS::Entity> contents;
std::unordered_map<guecs::Entity, std::string> $slot_to_name;
// NOTE: this should then become just an ECS id for a container
inventory::Model contents;
LootUI(GameLevel level);
void init();
@ -22,7 +25,7 @@ namespace gui {
bool mouse(float x, float y, bool hover);
void make_button(const std::string &name, const std::wstring& label, Events::GUI event);
void remove_slot(DinkyECS::Entity slot_id);
bool place_slot(DinkyECS::Entity gui_id, DinkyECS::Entity world_entity);
void remove_slot(guecs::Entity slot_id);
bool place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity);
};
}