Skip to content

Commit

Permalink
Merge pull request #831 from craftworkgames/add_copy-constructor-list…
Browse files Browse the repository at this point in the history
…ener

Add copy constructor for KeyboardListener.
  • Loading branch information
Gandifil committed Dec 28, 2023
2 parents 95cc5f4 + ebd181b commit 9393251
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/cs/MonoGame.Extended.Input/InputListeners/KeyboardListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ public KeyboardListener(KeyboardListenerSettings settings)
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; }
Expand Down

0 comments on commit 9393251

Please sign in to comment.