using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; namespace MonoGame.Extended.Input.InputListeners { /// /// This class contains all information resulting from events fired by /// . /// public class GamePadEventArgs : EventArgs { public GamePadEventArgs(GamePadState previousState, GamePadState currentState, TimeSpan elapsedTime, PlayerIndex playerIndex, Buttons? button = null, float triggerState = 0, Vector2? thumbStickState = null) { PlayerIndex = playerIndex; PreviousState = previousState; CurrentState = currentState; ElapsedTime = elapsedTime; if (button != null) Button = button.Value; TriggerState = triggerState; ThumbStickState = thumbStickState ?? Vector2.Zero; } /// /// The index of the controller. /// public PlayerIndex PlayerIndex { get; private set; } /// /// The state of the controller in the previous update. /// public GamePadState PreviousState { get; private set; } /// /// The state of the controller in this update. /// public GamePadState CurrentState { get; private set; } /// /// The button that triggered this event, if appliable. /// public Buttons Button { get; private set; } /// /// The time elapsed since last event. /// public TimeSpan ElapsedTime { get; private set; } /// /// If a TriggerMoved event, displays the responsible trigger's position. /// public float TriggerState { get; private set; } /// /// If a ThumbStickMoved event, displays the responsible stick's position. /// public Vector2 ThumbStickState { get; private set; } } }