From e6e7f56c9bba3b2191583c4c1d0599370d1f00c7 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 20 Mar 2025 15:30:13 -0400 Subject: pke: replace PkeArray with pk_arr_t --- editor/editor-main.cpp | 13 +++++++------ editor/editor.cpp | 17 ++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'editor') diff --git a/editor/editor-main.cpp b/editor/editor-main.cpp index 4e26472..a037ca6 100644 --- a/editor/editor-main.cpp +++ b/editor/editor-main.cpp @@ -1,5 +1,6 @@ #include +#include "pk.h" #include "arg-handler.hpp" #include "plugins.hpp" #include "editor.hpp" @@ -21,12 +22,12 @@ int main(int argc, char *argv[]) { { pkeSettings.isSimulationPaused = true; pkeSettings.isShowingEditor = true; - LoadedPkePlugins.Push({ - .OnInit = PkeEditor_Init, - .OnTick = PkeEditor_Tick, - .OnTeardown = PkeEditor_Teardown, - .OnImGuiRender = PkeEditor_RecordImGui, - }); + PKEPluginInterface itfc; + itfc.OnInit = PkeEditor_Init; + itfc.OnTick = PkeEditor_Tick; + itfc.OnTeardown = PkeEditor_Teardown; + itfc.OnImGuiRender = PkeEditor_RecordImGui; + pk_arr_append(&LoadedPkePlugins, &itfc); } // run PkeArgs_Parse(argc, argv); diff --git a/editor/editor.cpp b/editor/editor.cpp index 14b2777..685d402 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -2,7 +2,6 @@ #include "editor.hpp" #include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h" -#include "array.hpp" #include "asset-manager.hpp" #include "camera.hpp" #include "ecs.hpp" @@ -1662,22 +1661,22 @@ void RecordImGuiSceneEditor() { ImGui::Spacing(); if (selectedEntity != nullptr) { - static PkeArray entGrBinds; - static PkeArray entInstances; + static pk_arr_t entGrBinds; + static pk_arr_t entInstances; static EntityType *entType; bool reset = false; if (entGrBinds.next > 0) { - if (entGrBinds.data[0]->entHandle != selectedEntity->entHandle) { + if (entGrBinds[0]->entHandle != selectedEntity->entHandle) { reset = true; } } else if (entInstances.next > 0) { - if (entInstances.data[0]->entHandle != selectedEntity->entHandle) { + if (entInstances[0]->entHandle != selectedEntity->entHandle) { reset = true; } } if (reset) { - PkeArray_SoftReset(&entGrBinds); - PkeArray_SoftReset(&entInstances); + pk_arr_clear(&entGrBinds); + pk_arr_clear(&entInstances); entType = nullptr; } if (entGrBinds.next == 0) @@ -1699,10 +1698,10 @@ void RecordImGuiSceneEditor() { } ImGui::Text("%s: %08x %08x", "Entity Handle: ", selectedEntity->entHandle.bucketIndex, selectedEntity->entHandle.itemIndex); for (int64_t i = 0; i < entGrBinds.next; ++i) { - RecordImGui_CompGrBinds(true, entGrBinds.data[i]); + RecordImGui_CompGrBinds(true, entGrBinds[i]); } for (int64_t i = 0; i < entInstances.next; ++i) { - RecordImGui_CompInstPos(false, entInstances.data[i]); + RecordImGui_CompInstPos(false, entInstances[i]); } } -- cgit v1.2.3