16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 07:39:19 +02:00

Merge pull request #87 from nowahue/ecs

Change in entity hierarchy naming
This commit is contained in:
2026-04-08 01:45:14 +02:00
committed by GitHub

View File

@@ -496,12 +496,16 @@ void ui_layer::render_entity_hierarchy(ECWorld& world)
for (auto entity : world.GetEntities())
{
char buf[64];
std::snprintf(buf, sizeof(buf), "Entity %u", static_cast<unsigned>(entity));
std::string buf;
buf.reserve(64);
if (world.HasComponent<ECSComponent::Identification>(entity))
buf = world.GetComponent<ECSComponent::Identification>(entity) -> Name.ToString();
else
buf = std::to_string(static_cast<unsigned>(entity));
const bool selected = (m_selected_entity == entity);
if (ImGui::Selectable(buf, selected))
if (ImGui::Selectable(buf.c_str(), selected))
{
m_selected_entity = entity;
}