The GamePadState structure for the GamePad class has the follow
The Buttons member is a structure that contains members for each
of the controls on a gamepad — A, B, Back, LeftShoulder, LeftStick,
RightShoulder, RightStick, Start, X, and Y. Each of these members
is a ButtonState enum value that has two possibilities, Pressed and
The DPad member is another structure set up exactly the same;
it has four ButtonState type members in a structure for each of the
four directions in the D-pad.
The IsConnected member is self-explanatory. If for some reason
the gamepad were disconnected, you wouldn’t want to try to cap
ture data and you would probably even want to pause the game and
display a message asking the player to reconnect the controller.
PacketNumber is an integer value that you can use to determine
if the state of the device has changed, rather than checking the con
trols themselves. So you could do something like:
PacketNumber != _curPacketNum)
//save the new packet number
_curPacketNum = GamePad.GetState(PlayerIndex.One).