From d1c5d4ac7febde0a56c1d2a319fe96d6a6c97980 Mon Sep 17 00:00:00 2001 From: Evan Hemsley Date: Thu, 28 Dec 2023 09:29:29 -0800 Subject: [PATCH] Pump events in Keyboard.GetState --- src/Input/Keyboard.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Input/Keyboard.cs b/src/Input/Keyboard.cs index 37f9855b..a7075049 100644 --- a/src/Input/Keyboard.cs +++ b/src/Input/Keyboard.cs @@ -27,6 +27,9 @@ public static class Keyboard /// Current keyboard state. 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);