Skip to content

Commit

Permalink
Pump events in Keyboard.GetState
Browse files Browse the repository at this point in the history
  • Loading branch information
thatcosmonaut committed Dec 28, 2023
1 parent 40b9429 commit d1c5d4a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Input/Keyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public static class Keyboard
/// <returns>Current keyboard state.</returns>
public unsafe static KeyboardState GetState()
{
// Pump events to ensure input is up-to-date.
SDL2.SDL.SDL_PumpEvents();

// SDL_GetKeyboardState returns a pointer that does not need to be freed.
byte* state = (byte*) SDL2.SDL.SDL_GetKeyboardState(out int numkeys);

Expand Down

0 comments on commit d1c5d4a

Please sign in to comment.