7#include "../ECS_Components.h"
33 std::cout <<
"[EntityInspectorManager] Initializing...\n";
39 std::cout <<
"[EntityInspectorManager] Initialized with " <<
m_EntityList.size() <<
" entities\n";
47 std::cout <<
"[EntityInspectorManager] Shutting down...\n";
76 string name =
"Entity_" + std::to_string(entity);
88 std::cout <<
"[EntityInspectorManager] Entity created: " << entity <<
"\n";
105 std::cout <<
"[EntityInspectorManager] Entity destroyed: " << entity <<
"\n";
117 auto& components =
it->second.componentTypes;
118 if (std::find(components.begin(), components.end(), componentType) == components.end())
120 components.push_back(componentType);
133 auto& components =
it->second.componentTypes;
134 auto compIt = std::find(components.begin(), components.end(), componentType);
135 if (
compIt != components.end())
149 std::vector<EntityInfo>
result;
177 return it->second.componentTypes;
185 return std::find(components.begin(), components.end(), componentType) != components.end();
190 std::vector<ComponentPropertyInfo> properties;
201 if (componentType ==
"Position_data")
210 prop.value = std::to_string(
comp.position.x);
212 properties.push_back(
prop);
215 prop.value = std::to_string(
comp.position.y);
217 properties.push_back(
prop);
220 prop.value = std::to_string(
comp.position.z);
222 properties.push_back(
prop);
225 else if (componentType ==
"Velocity_data")
234 prop.value = std::to_string(
comp.velocity.x);
236 properties.push_back(
prop);
239 prop.value = std::to_string(
comp.velocity.y);
241 properties.push_back(
prop);
244 prop.value = std::to_string(
comp.velocity.z);
246 properties.push_back(
prop);
255 const std::string& propertyName,
const std::string& value)
271 float floatValue = std::stof(value);
273 if (propertyName ==
"x")
274 comp.position.x = floatValue;
275 else if (propertyName ==
"y")
276 comp.position.y = floatValue;
277 else if (propertyName ==
"z")
278 comp.position.z = floatValue;
295 float floatValue = std::stof(value);
297 if (propertyName ==
"dx")
298 comp.velocity.x = floatValue;
299 else if (propertyName ==
"dy")
300 comp.velocity.y = floatValue;
301 else if (propertyName ==
"dz")
302 comp.velocity.z = floatValue;
319 std::vector<EntityID>
result;
329 if (
it->second.name.find(
nameFilter) != std::string::npos)
339 std::vector<EntityID>
result;
381 info.componentTypes.clear();
389 info.componentTypes.push_back(
"Position_data");
391 info.componentTypes.push_back(
"Velocity_data");
393 info.componentTypes.push_back(
"Sprite_data");
395 info.componentTypes.push_back(
"Health_data");
397 info.componentTypes.push_back(
"Controller_data");
399 info.componentTypes.push_back(
"PlayerBinding_data");
401 info.componentTypes.push_back(
"PlayerController_data");
410 return entitySignatures.find(entity) == entitySignatures.end();
420 return "UnknownComponent";
std::bitset< MAX_COMPONENTS > ComponentSignature
ComponentTypeID GetComponentTypeID_Static()
std::uint64_t ComponentTypeID
const EntityID INVALID_ENTITY_ID
EntityInspectorManager - Manages runtime entity tracking and inspection Singleton that maintains a sy...
std::vector< EntityID > m_EntityList
std::vector< EntityID > GetAllEntities() const
void OnEntityCreated(EntityID entity)
EntityID m_SelectedEntity
std::vector< std::string > GetEntityComponents(EntityID entity) const
ComponentTypeID GetComponentTypeId(const std::string &name) const
static EntityInspectorManager & Instance()
void SetSelectedEntity(EntityID entity)
void OnComponentAdded(EntityID entity, const std::string &componentType)
EntityInfo GetEntityInfo(EntityID entity) const
std::vector< ComponentPropertyInfo > GetComponentProperties(EntityID entity, const std::string &componentType)
void ForceSyncWithWorld()
std::map< EntityID, EntityInfo > m_EntityInfoCache
bool HasComponent(EntityID entity, const std::string &componentType) const
bool SetComponentProperty(EntityID entity, const std::string &componentType, const std::string &propertyName, const std::string &value)
void OnComponentRemoved(EntityID entity, const std::string &componentType)
void OnEntityDestroyed(EntityID entity)
~EntityInspectorManager()
std::vector< EntityID > FilterByName(const std::string &nameFilter) const
std::string GetComponentName(ComponentTypeID typeId) const
bool IsEntityValid(EntityID entity) const
std::vector< EntityID > FilterByComponent(const std::string &componentType) const
std::vector< EntityInfo > GetAllEntityInfo() const
Core ECS manager and world coordinator.
static World & Get()
Get singleton instance (short form)
bool HasComponent(EntityID entity) const
bool IsEntityValid(EntityID entity) const
T & GetComponent(EntityID entity)
std::unordered_map< EntityID, ComponentSignature > m_entitySignatures
Identity component for entity identification.
std::string name
Entity name identifier.
Position component for spatial location.