Open jakubtomsu opened 5 months ago
Hmm yeah I'm seeing the same thing in the "doom-sokol" example (on Windows, haven't tested other platforms).
One workaround seems to be to disable, and then enable again the mouse lock in the FOCUSED event like this:
...the explicit disabling is necessary because of this check:
I seem to remember that this was necessary because there's a Windows routine somewhere in there which has something like a reference counter.
Maybe the same is necessary when going from iconified back to restored.
Btw: I'll be travelling from tomorrow until Thursday, I may not respond during that time.
PS: I should really tackle that higher level "sokol_input.h" header which tracks input events, provides a polling API and takes care of little warts like this that are hard to do right down in sokol_app.h with its "stateless" input events.
Thank you, I'll try that out. The sokol_input header would be cool, especially if there was also support for gamepads (or have a separate sokol_gamepad which I've seen mentioned)
I'm making a 3d FPS game with sokol_app and sokol_gfx, and I use
sapp.lock_mouse(true)
andsapp.show_mouse(false)
to get the correct hidden FPS cursor behavior. However after alt-tabbing out of the app and focusing back it is broken. The mouse is hidden, but it can exit the clipping rectangle and move to another monitor.I tried to call lock_mouse and show_mouse both only in
init_cb
or every frame, both approaches don't work in slightly different ways.Maybe the issue is with my code, I haven't had time to investigate further. But any help is appreciated :)