Fixed issue when GetState() call rewrites previous states.

This commit is contained in:
unknown
2022-06-22 17:33:44 +03:00
parent c90365211e
commit 8ab475438a
2 changed files with 10 additions and 2 deletions
@@ -9,10 +9,14 @@ namespace MonoGame.Extended.Input
private static KeyboardState _previousKeyboardState;
public static KeyboardStateExtended GetState()
{
return new KeyboardStateExtended(_currentKeyboardState, _previousKeyboardState);
}
public static Refresh()
{
_previousKeyboardState = _currentKeyboardState;
_currentKeyboardState = Keyboard.GetState();
return new KeyboardStateExtended(_currentKeyboardState, _previousKeyboardState);
}
}
}
@@ -11,10 +11,14 @@ namespace MonoGame.Extended.Input
private static MouseState _previousMouseState;
public static MouseStateExtended GetState()
{
return new MouseStateExtended(_currentMouseState, _previousMouseState);
}
public static Refresh()
{
_previousMouseState = _currentMouseState;
_currentMouseState = Mouse.GetState();
return new MouseStateExtended(_currentMouseState, _previousMouseState);
}
public static void SetPosition(int x, int y) => Mouse.SetPosition(x, y);