GamePadState Structure (Microsoft.Xna.Framework.Input)

Represents specific information about the state of the controller, including the current state of buttons and sticks. This is implemented as a partial struct to allow for individual platforms to offer additional data without separate state queries to GamePad.

Namespace: Microsoft.Xna.Framework.Input
Assembly: MonoGame.Framework (MonoGame.Framework.dll 3.8.0.1082)
  • C#
  • VB
  • F#
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = -1, Size = -1)]
public struct GamePadState

Syntax for VB is not yet implemented.

Syntax for F# is not yet implemented.

The GamePadState type exposes the following members.

  Platforms Name Description
GamePadState(GamePadThumbSticks, GamePadTriggers, GamePadButtons, GamePadDPad) Initializes a new instance of the GamePadState struct using the specified GamePadThumbSticks, GamePadTriggers, GamePadButtons, and GamePadDPad. 
GamePadState(Vector2, Vector2, float, float, Buttons) Initializes a new instance of the GamePadState struct using the specified stick, trigger, and button values. 
GamePadState(Vector2, Vector2, float, float, Buttons[]) Initializes a new instance of the GamePadState struct using the specified stick, trigger, and button values. 
Top
  Platforms Name Description
Default The default initialized gamepad state. 
Top
  Platforms Name Description
Buttons Gets a structure that identifies what buttons on the controller are pressed. 
DPad Gets a structure that identifies what directions of the directional pad on the controller are pressed. 
IsConnected Gets a value indicating if the controller is connected. 
PacketNumber Gets the packet number associated with this state. 
ThumbSticks Gets a structure that indicates the position of the controller sticks (thumbsticks). 
Triggers Gets a structure that identifies the position of triggers on the controller. 
Top
  Platforms Name Description
Equals Determines whether the specified System.Object is equal to the current GamePadState. (Overrides ValueType.Equals().)
GetHashCode Serves as a hash function for a GamePadState object. (Overrides ValueType.GetHashCode().)
IsButtonDown Determines whether specified input device buttons are pressed in this GamePadState. 
IsButtonUp Determines whether specified input device buttons are released (not pressed) in this GamePadState. 
ToString Returns a System.String that represents the current GamePadState. (Overrides ValueType.ToString().)
Top
  Platforms Name Description
Equality Determines whether a specified instance of GamePadState is equal to another specified GamePadState
Inequality Determines whether a specified instance of GamePadState is not equal to another specified GamePadState
Top
Supported in:

    
 Windows DirectX Desktop
    
 Linux Desktop
    
 Windows OpenGL Desktop
    
 Web