You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using gainput (https://github.com/jkuhlmann/gainput) for input management and on windows I have to pass in all windows message manually for gainput to correctly register mouse and keyboard events
// Update Gainput
manager.Update();
MSG msg;
while (PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
// Forward any input messages to Gainput
manager.HandleMessage(msg);
}
unfortunately sokol_app "swallows" all win32 event messages and I have no way to stop sokol from stealing my events.
I found a workaround that makes me handle win32 events before sokol does. I have to paste the following code before the #define SOKOL_IMPL
Hmm yeah that's a good point. I need to think of a good way to expose this type of stuff though because I can't have any Win32-types in the "public API". So basically a callback which takes a void* which would need to be cast to a MSG* in the user-provided callback.
The callback should be passed in via sapp_desc, e.g.
There should also be a second sapp_desc callback type with a user_data pointer (same as with the init/frame/event/cleanup callbacks).
I probably won't get around implementing this for a little while because I'm still focused on the WebGPU backend, but you could provide a pull request in the meantime if you want :)
Now about Gainput specifically. They are using MSG structures but they seem to only use the message, wParam, and lParam members. I think you can forward the messages from a custom WNDPROC.
I am using gainput (https://github.com/jkuhlmann/gainput) for input management and on windows I have to pass in all windows message manually for gainput to correctly register mouse and keyboard events
unfortunately sokol_app "swallows" all win32 event messages and I have no way to stop sokol from stealing my events.
I found a workaround that makes me handle win32 events before sokol does. I have to paste the following code before the
#define SOKOL_IMPL
then in my main app I just have to implement
this works fine, but I am wondering if it is possible to add "native" event callbacks to sapp_desc to handle such cases.
Greetings!
~ Rico (Ex Bigpoint Member)
The text was updated successfully, but these errors were encountered: