Merge pull request #770 from KRC2000/develop

Fixed issue when GetState() call rewrites previous states.
This commit is contained in:
Lucas Girouard-Stranks
2022-06-23 14:51:11 -04:00
committed by GitHub
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);