diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-11-16 17:48:34 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-11-16 17:48:34 -0500 |
| commit | d93268b739db8a3eb815bf69370d33a590b827cc (patch) | |
| tree | 7797210ade4064e49b15c82820c601089fe2dc19 /src/game.cpp | |
| parent | a6ec20bced20c489dfcf3702dfd99310dfbed7df (diff) | |
deleting instances works as expected
Diffstat (limited to 'src/game.cpp')
| -rw-r--r-- | src/game.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp index 7069ac9..bb4bbd6 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -532,6 +532,13 @@ void Game_Tick(double delta) { } ECS_Tick_Early(delta); + if (EntitiesToBeRemoved.Has(selectedEntity)) { + selectedEntity = EntityHandle_MAX; + } + if (EntitiesToBeRemoved.Has(hoveredEntity)) { + hoveredEntity = EntityHandle_MAX; + } + ECS_Tick(delta); PkeInput_Tick(delta); @@ -751,9 +758,6 @@ void Game_Tick(double delta) { cameraDbg.rot = glm::quat(glm::vec3(0.f, 0.f, axis4)) * cameraDbg.rot; cameraDbg.stale = cameraDbg.stale | PKE_CAMERA_STALE_ROT; } - } else { - cameraDefault.target = glm::vec3(0.f, 0.f, 0.f); - cameraDefault.stale = cameraDefault.stale | PKE_CAMERA_STALE_ROT; } EntityType_Tick_Late(delta); ECS_Tick_Late(delta); @@ -849,13 +853,14 @@ void RecordImGuiEntityList() { ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg }; - if (ImGui::BeginTable("Entities", 6, tableFlags)) { + if (ImGui::BeginTable("Entities", 7, tableFlags)) { ImGui::TableSetupColumn("Select"); ImGui::TableSetupColumn("EntityHandle"); ImGui::TableSetupColumn("ParentEntityHandle"); ImGui::TableSetupColumn("GrBindsHandle"); ImGui::TableSetupColumn("InstanceHandle"); ImGui::TableSetupColumn("IsMarkedForRemoval"); + ImGui::TableSetupColumn("Delete"); ImGui::TableHeadersRow(); uint64_t bucketCount = ECS_GetEntities_BucketCount(); @@ -868,8 +873,10 @@ void RecordImGuiEntityList() { ImGui::PushID(row); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); + ImGui::BeginDisabled(selectedEntity == entity->handle); if (ImGui::Button("Select")) selectedEntity = entity->handle; + ImGui::EndDisabled(); ImGui::TableSetColumnIndex(1); ImGui::Text("0x%016lX", static_cast<EntityHandle_T>(entity->handle)); ImGui::TableSetColumnIndex(2); @@ -880,6 +887,11 @@ void RecordImGuiEntityList() { ImGui::Text("0x%016lX", static_cast<InstanceHandle_T>(entity->instanceHandle)); ImGui::TableSetColumnIndex(5); ImGui::Text("%u", entity->isMarkedForRemoval); + ImGui::TableSetColumnIndex(6); + ImGui::BeginDisabled(selectedEntity != entity->handle); + if (ImGui::Button("Delete")) + ECS_MarkForRemoval(entity->handle); + ImGui::EndDisabled(); ImGui::PopID(); } ImGui::PopID(); |
