mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-18 08:29:29 +00:00
Fixed issue when GetState() call rewrites previous states.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user