mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-25 08:22:15 +00:00
Added a property to set whether the repeat press event should be invoked or not. (#426)
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user