Added a property to set whether the repeat press event should be invoked or not. (#426)

This commit is contained in:
Piku201
2017-09-26 21:06:40 +10:00
committed by Dylan Wilson
parent be1eb0e944
commit 9b257eb529
2 changed files with 7 additions and 1 deletions
@@ -20,10 +20,12 @@ namespace MonoGame.Extended.Input.InputListeners
public KeyboardListener(KeyboardListenerSettings settings)
{
RepeatPress = settings.RepeatPress;
InitialDelay = settings.InitialDelayMilliseconds;
RepeatDelay = settings.RepeatDelayMilliseconds;
}
public bool RepeatPress { get; }
public int InitialDelay { get; }
public int RepeatDelay { get; }
@@ -37,7 +39,9 @@ namespace MonoGame.Extended.Input.InputListeners
RaisePressedEvents(gameTime, currentState);
RaiseReleasedEvents(currentState);
RaiseRepeatEvents(gameTime, currentState);
if (RepeatPress)
RaiseRepeatEvents(gameTime, currentState);
_previousState = currentState;
}
@@ -4,10 +4,12 @@ namespace MonoGame.Extended.Input.InputListeners
{
public KeyboardListenerSettings()
{
RepeatPress = true;
InitialDelayMilliseconds = 800;
RepeatDelayMilliseconds = 50;
}
public bool RepeatPress { get; set; }
public int InitialDelayMilliseconds { get; set; }
public int RepeatDelayMilliseconds { get; set; }