From b729208fc3b96d03944bc51bb99a31903cc5cc45 Mon Sep 17 00:00:00 2001 From: austin Date: Fri, 16 Aug 2024 19:07:22 -0400 Subject: [PATCH] fix f2 menu controls reset bug --- docs/src/progress/currenttarget.md | 1 - docs/src/progress/renderertodo.md | 3 +++ .../menu/debug/ImGuiWindowMacros.java | 14 ++++++++++++++ .../renderer/pipelines/ImGuiPipeline.java | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/src/progress/currenttarget.md b/docs/src/progress/currenttarget.md index 22a94861..8b35f32b 100644 --- a/docs/src/progress/currenttarget.md +++ b/docs/src/progress/currenttarget.md @@ -19,7 +19,6 @@ + bug fixes Fix AI tracking deleted entity Fix server ground movement tree playing animation over falling animation - Fix F2 menu not regaining controls when Xing menu instead of hitting F2 to close Fix empty item slot not showing underneath dragged item Fix grass rendering distance diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 2b0f4137..90e35d54 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -600,6 +600,7 @@ Fix broken rendering pipeline when creating new level Fix ui alignment for item panels in inventory menus (ie dont have to place in corner) Netconfig file support Fix rotation not sending correctly on initialization of creatures on client +Fix F2 menu not regaining controls when Xing menu instead of hitting F2 to close # TODO @@ -622,6 +623,8 @@ Bug Fixes - Fix not all grass tiles update when updating a nearby voxel (ie it doesn't go into negative coordinates to scan for foliage updates) - Fix typescript load error - Calculate bounding sphere for meshes by deforming vertices with bone default pose instead of no bone deform + - Fix character creation menu + - Fix text input collapsing while typing Startup Performance - Cache loaded typescript diff --git a/src/main/java/electrosphere/menu/debug/ImGuiWindowMacros.java b/src/main/java/electrosphere/menu/debug/ImGuiWindowMacros.java index 2e5f8bfc..c3aa0994 100644 --- a/src/main/java/electrosphere/menu/debug/ImGuiWindowMacros.java +++ b/src/main/java/electrosphere/menu/debug/ImGuiWindowMacros.java @@ -21,6 +21,9 @@ public class ImGuiWindowMacros { //main debug menu private static ImGuiWindow mainDebugWindow; + //tracks if the debug menu is open + private static boolean debugIsOpen = false; + //Framerate graph private static ImGuiWindow globalFrametimeWindow; @@ -168,6 +171,7 @@ public class ImGuiWindowMacros { */ public static void toggleMainDebugMenu(){ mainDebugWindow.setOpen(!mainDebugWindow.isOpen()); + ImGuiWindowMacros.debugIsOpen = mainDebugWindow.isOpen(); if(mainDebugWindow.isOpen()){ Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_MAIN_MENU); } else { @@ -175,4 +179,14 @@ public class ImGuiWindowMacros { } } + /** + * Makes sure the main debug menu properly toggles controls if it is closed with the X button + */ + public static void synchronizeMainDebugMenuVisibility(){ + if(ImGuiWindowMacros.debugIsOpen && !mainDebugWindow.isOpen()){ + ImGuiWindowMacros.debugIsOpen = false; + Globals.controlHandler.hintUpdateControlState(ControlsState.MAIN_GAME); + } + } + } diff --git a/src/main/java/electrosphere/renderer/pipelines/ImGuiPipeline.java b/src/main/java/electrosphere/renderer/pipelines/ImGuiPipeline.java index 7253351c..107ffa14 100644 --- a/src/main/java/electrosphere/renderer/pipelines/ImGuiPipeline.java +++ b/src/main/java/electrosphere/renderer/pipelines/ImGuiPipeline.java @@ -62,6 +62,7 @@ public class ImGuiPipeline implements RenderPipeline { } ImGui.render(); imGuiGl13.renderDrawData(ImGui.getDrawData()); + ImGuiWindowMacros.synchronizeMainDebugMenuVisibility(); } }