-
-
Notifications
You must be signed in to change notification settings - Fork 308
Use SDL_GetKeyboardState instead of event polling #469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
flibitijibibo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally this makes sense, so we can go into the polishing stage at this point.
flibitijibibo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took care of the notes, as long as this works as intended this is ready to go.
c87ce2e to
88f940f
Compare
88f940f to
a814bab
Compare
|
May as well update this since it came up recently: We have reason to believe that XNA actually calls GetAsyncKeyState directly when GetState is called, and SDL doesn't expose a direct mapping to this (nor should it, woof). This may improve behavior but accurate behavior is likely impossible without insane levels of intervention in this specific class... |
|
I needed something like this for Wine Mono because I found the scenario where we need input events that were blocked: https://gitlab.winehq.org/mono/wine-mono/-/merge_requests/43 Revolver360 Re:Actor has an input library called Nuclex.Input that afaict hooks all keyboard messages through winforms and prevents them from being delivered. But the game doesn't use that library for keyboard input, it just calls Keyboard.GetState(). |
|
One last thing: Does the issue go away if we move our existing keydown/keyup events to an event watch? It's probably the best way to get these events without intercepting WndProc directly. |
We got a report from the Celeste modding/speedrunning community that FNA was causing input latency on keyboard relative to XNA. FNA currently processes keyboard input by processing all keyboard events in PollEvents and setting the keys in an internal array. But according to the report, XNA actually gets a new state every time Keyboard.GetState is called, not just once per frame. This patch brings the behavior in line with XNA, and it should address latency by allowing input polling to occur closer to when input is actually processed by the game.We got a report from the Celeste modding/speedrunning community that FNA was causing input latency on keyboard relative to XNA when an IME was installed. This patch gets the keyboard state directly all at once instead of iterating over keydown events. This might address some scenarios where the keydown event is intercepted by something. It should also be very slightly more efficient to not have to call
keys.Containson all keypresses.