Trouble Getting Correct ImGui Response to Mouse Input

Hi! I’m setting up a program with Vulkan + Win32 and I want to use DearImGui, but I’m having trouble getting it setup properly for mouse input. I copied the WinProc code in the DX11 example, and followed the SDL Vulkan one for rendering. In the end, I have the GUI Demo window running properly, and it also seems to track mouse position correctly, but clicking doesn’t seem to do anything. Does anyone have any ideas? Link to code on GitHub:

I found the issue! I skipped over the line that sets the MouseDown[button] to false in the example WndProc. Adding it fixed mouse input.

Glad to hear it is fixed.

You should consider not copying this code but rather using it as is… if you used ImGui_ImplWin32_WndProcHandler() as in the example you’ll always on latest.

If you copy/rewrite the code manually you are more likely to stumble on other bugs, you won’t benefit from update and features such as multi-viewports.

If I were to use the Win32 implementation files, would I need to add changes to my rendering code as well when these new features are completed? It wouldn’t be a dealbreaker, I just want to confirm with you.

Yes for multi-viewports you’ll likely need to add code for the rendering part too.

1 Like