Skip to content

ImGui usability tweaks#58

Merged
Fexty12573 merged 3 commits intoFexty12573:masterfrom
Pizzabelly:imgui-tweaks
Feb 14, 2026
Merged

ImGui usability tweaks#58
Fexty12573 merged 3 commits intoFexty12573:masterfrom
Pizzabelly:imgui-tweaks

Conversation

@Pizzabelly
Copy link
Contributor

The main things I'm trying to address:

  • Keyboard input not being blocked.
  • Mouse camera input spinning after the menu is toggled.
  • Hovering the menu locks the mouse to a position even if gamepad input is used.

Then some less significant workarounds for:

  • The toggle menu key gets sent to the game.
  • When Escape/Enter are used to exit/confirm an input field, those key presses will get sent to the game when relying only on io.WantCaptureKeyboard.
  • The mouse click used to re-focus or unfocus the menu will get sent to the game.

I tried to simplify the workarounds as much as I could but they're overall still a bit hacky.

Also, I added an option to enable keyboard navigation. I think io.ConfigNavEscapeClearFocusWindow could work pretty well here too but it's not in this version of ImGui.

Copy link
Owner

@Fexty12573 Fexty12573 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Looks good overall, just 2 minor nitpicks.

Also the build failing looks like some nuget/vcpkg issue so whatever. I assume you already built and tested this locally.

@Pizzabelly
Copy link
Contributor Author

I'm glad I can help and yes it builds for me locally. I ran into another issue while testing, though. I think it has to do with the previous logic sometimes deciding to completely skip mouse updates. Occasionally when opening a menu like the map or selecting a location for an expedition, if the mouse update was being skipped, you couldn't trigger the gamepad cursor (left stick) either. I reworked the mouse handling to never fully skip an update and instead use a flag in sMhGUI that decides whether to reset the cursor to the middle of the screen or not. Then, rely on manually blocking any other inputs of interest to avoid unintended actions. This results in better overall behavior with mouse camera input as well, like less jumps when going in and out of the ImGui window.

@Pizzabelly
Copy link
Contributor Author

I added to the comment about the GUI flag.

Also, for the sake of completeness, I was using this for testing.

diff --git a/SharpPluginLoader.Core/Rendering/Renderer.cs b/SharpPluginLoader.Core/Rendering/Renderer.cs
index 48d608e..ca63d1e 100644
--- a/SharpPluginLoader.Core/Rendering/Renderer.cs
+++ b/SharpPluginLoader.Core/Rendering/Renderer.cs
@@ -427,6 +427,17 @@ namespace SharpPluginLoader.Core.Rendering
                         }
                     }
 
+                    ImGui.Text($"lastUpdateHadFocus: {_lastUpdateHadFocus}");
+                    ImGui.Text($"lastUpdateHadKeyboard: {_lastUpdateHadKeyboard}");
+                    if (_waitForRelease == null)
+                    {
+                        ImGui.Text("waitForRelease: None");
+                    }
+                    else
+                    {
+                        ImGui.Text($"waitForRelease: {(Key)_waitForRelease}");
+                    }
+
                     foreach (var plugin in PluginManager.Instance.GetPlugins(pluginData => pluginData.OnImGuiRender))
                     {
                         if (plugin.PluginData.ImGuiWrappedInTreeNode)

Copy link
Owner

@Fexty12573 Fexty12573 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for your work!

@Fexty12573 Fexty12573 merged commit 77b2353 into Fexty12573:master Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants