Merge pull request #831 from craftworkgames/add_copy-constructor-listener

Add copy constructor for KeyboardListener.
This commit is contained in:
Max Kopjev
2023-12-28 08:20:51 +01:00
committed by GitHub
@@ -27,6 +27,21 @@ namespace MonoGame.Extended.Input.InputListeners
RepeatDelay = settings.RepeatDelayMilliseconds;
}
/// <summary>
/// Copy constructor
/// </summary>
/// <param name="keyboardListener">Listener, from which will copy inner state</param>
public KeyboardListener(KeyboardListener keyboardListener)
{
RepeatPress = keyboardListener.RepeatPress;
InitialDelay = keyboardListener.InitialDelay;
RepeatDelay = keyboardListener.RepeatDelay;
_keysValues = keyboardListener._keysValues;
_isInitial = keyboardListener._isInitial;
_previousKey = keyboardListener._previousKey;
_previousState = keyboardListener._previousState;
}
public bool RepeatPress { get; }
public int InitialDelay { get; }
public int RepeatDelay { get; }