using Microsoft.Xna.Framework;
namespace MonoGame.Extended.Input.InputListeners
{
///
/// This is a class that contains settings to be used to initialise a .
///
///
public class GamePadListenerSettings : InputListenerSettings
{
public GamePadListenerSettings()
: this(PlayerIndex.One)
{
}
///
/// This is a class that contains settings to be used to initialise a .
/// Note: There are a number of extra settings that are settable properties.
///
/// The index of the controller the listener will be tied to.
/// Whether vibration is enabled on the controller.
///
/// General setting for the strength of the left motor.
/// This motor has a slow, deep, powerful rumble.
/// This setting will modify all future vibrations
/// through this listener.
///
///
/// General setting for the strength of the right motor.
/// This motor has a snappy, quick, high-pitched rumble.
/// This setting will modify all future vibrations
/// through this listener.
///
public GamePadListenerSettings(PlayerIndex playerIndex, bool vibrationEnabled = true,
float vibrationStrengthLeft = 1.0f, float vibrationStrengthRight = 1.0f)
{
PlayerIndex = playerIndex;
VibrationEnabled = vibrationEnabled;
VibrationStrengthLeft = vibrationStrengthLeft;
VibrationStrengthRight = vibrationStrengthRight;
TriggerDownTreshold = 0.15f;
ThumbstickDownTreshold = 0.5f;
RepeatInitialDelay = 500;
RepeatDelay = 50;
}
///
/// The index of the controller.
///
public PlayerIndex PlayerIndex { get; set; }
///
/// When a button is held down, the interval in which
/// ButtonRepeated fires. Value in milliseconds.
///
public int RepeatDelay { get; set; }
///
/// The amount of time a button has to be held down
/// in order to fire ButtonRepeated the first time.
/// Value in milliseconds.
///
public int RepeatInitialDelay { get; set; }
///
/// Whether vibration is enabled for this controller.
///
public bool VibrationEnabled { get; set; }
///
/// General setting for the strength of the left motor.
/// This motor has a slow, deep, powerful rumble.
///
/// This setting will modify all future vibrations
/// through this listener.
///
///
public float VibrationStrengthLeft { get; set; }
///
/// General setting for the strength of the right motor.
/// This motor has a snappy, quick, high-pitched rumble.
///
/// This setting will modify all future vibrations
/// through this listener.
///
///
public float VibrationStrengthRight { get; set; }
///
/// The treshold of movement that has to be met in order
/// for the listener to fire an event with the trigger's
/// updated position.
///
/// In essence this defines the event's
/// resolution.
///
/// At a value of 0 this will fire every time
/// the trigger's position is not 0f.
///
public float TriggerDeltaTreshold { get; set; }
///
/// The treshold of movement that has to be met in order
/// for the listener to fire an event with the thumbstick's
/// updated position.
///
/// In essence this defines the event's
/// resolution.
///
/// At a value of 0 this will fire every time
/// the thumbstick's position is not {x:0, y:0}.
///
public float ThumbStickDeltaTreshold { get; set; }
///
/// How deep the triggers have to be depressed in order to
/// register as a ButtonDown event.
///
public float TriggerDownTreshold { get; set; }
///
/// How deep the triggers have to be depressed in order to
/// register as a ButtonDown event.
///
public float ThumbstickDownTreshold { get; private set; }
public override GamePadListener CreateListener()
{
return new GamePadListener(this);
}
}
}