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

Change in entity hierarchy naming

This commit is contained in:
nowahue
2026-04-08 01:43:03 +02:00
parent 43e6cef57d
commit dc0e9b591b

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;
}