From ebd181b07365e1cee2a6f69fa4ede69a62a158dc Mon Sep 17 00:00:00 2001 From: Gandifil Date: Thu, 28 Dec 2023 09:43:06 +0300 Subject: [PATCH] Add copy constructor for KeyboardListener. --- .../InputListeners/KeyboardListener.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cs/MonoGame.Extended.Input/InputListeners/KeyboardListener.cs b/src/cs/MonoGame.Extended.Input/InputListeners/KeyboardListener.cs index 9fc85a0f..4c207aca 100644 --- a/src/cs/MonoGame.Extended.Input/InputListeners/KeyboardListener.cs +++ b/src/cs/MonoGame.Extended.Input/InputListeners/KeyboardListener.cs @@ -27,6 +27,21 @@ namespace MonoGame.Extended.Input.InputListeners RepeatDelay = settings.RepeatDelayMilliseconds; } + /// + /// Copy constructor + /// + /// Listener, from which will copy inner state + 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; }