From 0fe364a2828ce912f651c07656ed5c63d39d357d Mon Sep 17 00:00:00 2001 From: Lilith Silver Date: Wed, 11 Oct 2023 02:47:30 -0700 Subject: [PATCH] fix allocating WasAnyKeyJustDown method; add GetPressedKeys non-alloc overload --- src/cs/MonoGame.Extended.Input/KeyboardStateExtended.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cs/MonoGame.Extended.Input/KeyboardStateExtended.cs b/src/cs/MonoGame.Extended.Input/KeyboardStateExtended.cs index 01464893..591aaf5e 100644 --- a/src/cs/MonoGame.Extended.Input/KeyboardStateExtended.cs +++ b/src/cs/MonoGame.Extended.Input/KeyboardStateExtended.cs @@ -22,9 +22,9 @@ namespace MonoGame.Extended.Input public bool IsKeyDown(Keys key) => _currentKeyboardState.IsKeyDown(key); public bool IsKeyUp(Keys key) => _currentKeyboardState.IsKeyUp(key); public Keys[] GetPressedKeys() => _currentKeyboardState.GetPressedKeys(); - + public void GetPressedKeys(Keys[] keys) => _currentKeyboardState.GetPressedKeys(keys); public bool WasKeyJustDown(Keys key) => _previousKeyboardState.IsKeyDown(key) && _currentKeyboardState.IsKeyUp(key); public bool WasKeyJustUp(Keys key) => _previousKeyboardState.IsKeyUp(key) && _currentKeyboardState.IsKeyDown(key); - public bool WasAnyKeyJustDown() => _previousKeyboardState.GetPressedKeys().Any(); + public bool WasAnyKeyJustDown() => _previousKeyboardState.GetPressedKeyCount() > 0; } -} \ No newline at end of file +}