diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-12-07 11:03:38 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-12-07 11:13:40 -0500 |
| commit | 8bbe530d7e5162ed47977c0381e61ed68c8f8ada (patch) | |
| tree | d405a054461a308784efcff2d27392d0e40ed946 /editor | |
| parent | e2e1d4646fa3a196b6247ba2dc04603d393df62f (diff) | |
Breaking change - add project file - EntityType
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/editor.cpp | 82 |
1 files changed, 50 insertions, 32 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index 1786a18..8107ee3 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -1,6 +1,7 @@ #include "editor.hpp" +#include "project.hpp" #include "thread_pool.hpp" #include "game.hpp" #include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h" @@ -13,6 +14,7 @@ #include "vendor/glm_include.hpp" #include "vendor/tinyfiledialogs//tinyfiledialogs.h" #include "imgui.h" + #include <future> const char *dbgCtrl_CameraLeft = "debug-camera-left"; @@ -58,6 +60,7 @@ bool shouldOpenLoadSceneDialog = false; bool shouldOpenSaveSceneDialog = false; bool shouldLoadScene = false; bool shouldSaveScene = false; +bool shouldSaveProjectFile = false; glm::vec3 unproject(glm::vec3 windowCoords) { double xDevNorm = (2.0f * windowCoords.x) / Extent.width - 1.0f; @@ -82,6 +85,9 @@ void PkeEditor_Tick(double delta) { if (shouldDisableEditor) { PkeEditor_Teardown(); } + if (shouldSaveProjectFile) { + PkeProject_Save(); + } if (shouldOpenLoadSceneDialog) { shouldOpenLoadSceneDialog = false; PkeThreads_Enqueue(threadPoolHandle, std::packaged_task<void()>( [] { @@ -727,48 +733,60 @@ void RecordImGui_CompInstPos(bool readonly, CompInstance *component) { ImGui::Spacing(); } -void RecordImGuiSceneEditor() { - { - if (!ImGui::Begin("SceneEditorEntityTypes", &pkeSettings.editorSettings.isShowingSceneEditor)) { - ImGui::End(); - return; - } - if (ImGui::Button("Create Entity Type")) { - ImGui::OpenPopup("CreateEntityType"); - } - if (ImGui::Button("Save")) { - shouldSaveScene = true; - } - if (sceneName) { - ImGui::SameLine(); - ImGui::Text("%s", sceneName); - } - if (ImGui::Button("Save As...")) { - shouldOpenSaveSceneDialog = true; - } - if (ImGui::Button("Load")) { - shouldOpenLoadSceneDialog = true; - } - if (ImGui::Button("Clear Selection")) { - selectedEntity = EntityHandle_MAX; - } - - ImGui::Spacing(); +void RecordImGuiProjectSettingsEditor() { + if (!ImGui::Begin("ProjectSettings")) { + ImGui::End(); + return; + } - if (selectedEntity != EntityHandle_MAX) { - RecordImGui_CompGrBinds(true, ECS_GetGrBinds(selectedEntity)); - RecordImGui_CompInstPos(false, ECS_GetInstance(selectedEntity)); - } + if (ImGui::Button("Save")) { + shouldSaveProjectFile = true; + } - RecordImGuiModalCreateEntityType(); + ImGui::End(); +} +void RecordImGuiSceneEditor() { + if (!ImGui::Begin("SceneEditorEntityTypes", &pkeSettings.editorSettings.isShowingSceneEditor)) { ImGui::End(); + return; + } + if (ImGui::Button("Create Entity Type")) { + ImGui::OpenPopup("CreateEntityType"); + } + if (ImGui::Button("Save")) { + shouldSaveScene = true; + } + if (sceneName) { + ImGui::SameLine(); + ImGui::Text("%s", sceneName); + } + if (ImGui::Button("Save As...")) { + shouldOpenSaveSceneDialog = true; + } + if (ImGui::Button("Load")) { + shouldOpenLoadSceneDialog = true; } + if (ImGui::Button("Clear Selection")) { + selectedEntity = EntityHandle_MAX; + } + + ImGui::Spacing(); + + if (selectedEntity != EntityHandle_MAX) { + RecordImGui_CompGrBinds(true, ECS_GetGrBinds(selectedEntity)); + RecordImGui_CompInstPos(false, ECS_GetInstance(selectedEntity)); + } + + RecordImGuiModalCreateEntityType(); + + ImGui::End(); } void PkeEditor_RecordImGui() { if (pkeSettings.isShowingEditor) { RecordImGuiEditorWrapper(); + RecordImGuiProjectSettingsEditor(); RecordImGuiEntityList(); RecordImGuiSceneEditor(); RecordImGuiUBO(); |
