blob: 9b113c6d724f9567652aba16354e4ccc401bd6bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
namespace MonoGame.Extended.Input.InputListeners
{
/// <summary>
/// This class contains all information resulting from events fired by
/// <see cref="GamePadListener" />.
/// </summary>
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;
}
/// <summary>
/// The index of the controller.
/// </summary>
public PlayerIndex PlayerIndex { get; private set; }
/// <summary>
/// The state of the controller in the previous update.
/// </summary>
public GamePadState PreviousState { get; private set; }
/// <summary>
/// The state of the controller in this update.
/// </summary>
public GamePadState CurrentState { get; private set; }
/// <summary>
/// The button that triggered this event, if appliable.
/// </summary>
public Buttons Button { get; private set; }
/// <summary>
/// The time elapsed since last event.
/// </summary>
public TimeSpan ElapsedTime { get; private set; }
/// <summary>
/// If a TriggerMoved event, displays the responsible trigger's position.
/// </summary>
public float TriggerState { get; private set; }
/// <summary>
/// If a ThumbStickMoved event, displays the responsible stick's position.
/// </summary>
public Vector2 ThumbStickState { get; private set; }
}
}
|