From 78621bab9fd6401e4e83493360a46f12bddf4299 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 28 Sep 2023 11:11:24 -0400 Subject: more than the first entity is now selectable and properly get CompInstance from ECS --- src/game.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 2c87818..78fa093 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -283,10 +283,13 @@ void RecordImGuiEntityList() { for (long bucket = 0; bucket < bucketCount; ++bucket) { uint64_t itemCount = 0; auto *entities = ECS_GetEntities(bucket, itemCount); + ImGui::PushID(bucket); for (long row = 0; row < itemCount; row++) { auto *entity = &entities[row]; + ImGui::PushID(row); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); + char label[32]; if (ImGui::Button("Select")) selectedEntity = entity->handle; ImGui::TableSetColumnIndex(1); @@ -299,7 +302,9 @@ void RecordImGuiEntityList() { ImGui::Text("0x%016lX", static_cast(entity->instanceHandle)); ImGui::TableSetColumnIndex(5); ImGui::Text("%u", entity->isMarkedForRemoval); + ImGui::PopID(); } + ImGui::PopID(); } ImGui::EndTable(); } -- cgit v1.2.3