diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-12-05 15:27:16 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-12-05 20:39:07 -0500 |
| commit | dca5d9089086c9a845e10cc26b1966f237975a64 (patch) | |
| tree | dd67070121c3cfd664aaebbbc02f9e1b639c3894 /editor | |
| parent | bbde646e46f8993fcf1f30ead6b7376f1670f389 (diff) | |
editor cleanup
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/editor.cpp | 13 | ||||
| -rw-r--r-- | editor/main.cpp | 6 |
2 files changed, 14 insertions, 5 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index 23a748f..1d2ccd6 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -142,7 +142,12 @@ void PkeEditor_Tick(double delta) { hoveredEntity = EntityHandle_MAX; if (!imGuiHovered) { double xMousePos, yMousePos; - glfwGetCursorPos(window, &xMousePos, &yMousePos); + if (pkeSettings.editorSettings.isUsingDebugCamera) { + xMousePos = Extent.width / 2.0; + yMousePos = Extent.height / 2.0; + } else { + glfwGetCursorPos(window, &xMousePos, &yMousePos); + } glm::vec3 fromCoords{unproject(glm::vec3(xMousePos, yMousePos, -1.f))}; glm::vec3 toCoords{unproject(glm::vec3(xMousePos, yMousePos, 1.f))}; @@ -246,12 +251,9 @@ void PkeEditor_Tick(double delta) { if (posEvent->xMotion || posEvent->yMotion) { glm::vec3 axis1Heading = glm::conjugate(cameraDbg.rot) * glm::vec3(1.f, 0.f, 0.f); glm::vec3 axis2Heading = glm::conjugate(cameraDbg.rot) * glm::vec3(0.f, 1.f, 0.f); - // glm::vec3 axis1Heading = cameraDbg.rot * glm::vec3(1.f, 0.f, 0.f); - // glm::vec3 axis2Heading = cameraDbg.rot * glm::vec3(0.f, 1.f, 0.f); glm::quat pitch = glm::angleAxis(float(posEvent->yMotion) * 0.01f, glm::normalize(axis1Heading)); glm::quat yaw = glm::angleAxis(float(posEvent->xMotion) * 0.01f, glm::normalize(axis2Heading)); glm::quat rot = cameraDbg.rot * pitch * yaw; - // rot = glm::normalize(rot); auto eul = glm::eulerAngles(rot); cameraDbg.rot = glm::quat(eul); cameraDbg.stale = cameraDbg.stale | PKE_CAMERA_STALE_ROT; @@ -365,7 +367,9 @@ void RecordImGuiEditorWrapper() { } if (ImGui::BeginMenu("Debug")) { ImGui::Checkbox("Show Debug Hitboxes", &pkeSettings.isRenderingDebug); + ImGui::BeginDisabled(); ImGui::Checkbox("Pause Physics Simulation", &pkeSettings.isSimulationPaused); + ImGui::EndDisabled(); if (ImGui::Checkbox("Uncap Framerate", &pkeSettings.graphicsSettings.isFramerateUnlocked)) { shouldRecreateSwapchain = true; } @@ -376,6 +380,7 @@ void RecordImGuiEditorWrapper() { if (ImGui::Checkbox("Use Debug Camera", &pkeSettings.editorSettings.isUsingDebugCamera)) { if (pkeSettings.editorSettings.isUsingDebugCamera) { shouldUnlockCamera = true; + ImGui::CloseCurrentPopup(); } else { shouldLockCamera = true; } diff --git a/editor/main.cpp b/editor/main.cpp index c0cc7c0..ce689e8 100644 --- a/editor/main.cpp +++ b/editor/main.cpp @@ -14,9 +14,13 @@ void signal_handler(int signal_num) { int main() { signal(SIGTERM, signal_handler); - fprintf(stdout, "PKE_EDITOR ENTERING\n"); + fflush(stdout); + fflush(stderr); + fprintf(stdout, "\rPKE_EDITOR ENTERING\n"); + fprintf(stderr, "\r"); // setup { + pkeSettings.isSimulationPaused = true; pkeSettings.isShowingEditor = true; pkePlugin.OnInit = PkeEditor_Init; pkePlugin.OnTick = PkeEditor_Tick; |
