GamePad¶
-
class
GamePad
: System.Object Supports querying the game controllers and setting the vibration motors.
-
readonly int
MaximumGamePadCount
The maximum number of game pads supported on this system. Attempting to access a gamepad index higher than this number will result in an T:System.InvalidOperationException being thrown by the API.
-
public GamePadCapabilities
GetCapabilities
(PlayerIndex playerIndex) Returns the capabilites of the connected controller.
Parameters: - playerIndex (Microsoft.Xna.Framework.PlayerIndex) – Player index for the controller you want to query.
Returns: The capabilites of the controller.
-
public GamePadCapabilities
GetCapabilities
(int index) Returns the capabilites of the connected controller.
Parameters: - index (int) – Index for the controller you want to query.
Returns: The capabilites of the controller.
-
public GamePadState
GetState
(PlayerIndex playerIndex) Gets the current state of a game pad controller with an independent axes dead zone.
Parameters: - playerIndex (Microsoft.Xna.Framework.PlayerIndex) – Player index for the controller you want to query.
Returns: The state of the controller.
-
public GamePadState
GetState
(int index) Gets the current state of a game pad controller with an independent axes dead zone.
Parameters: - index (int) – Index for the controller you want to query.
Returns: The state of the controller.
-
public GamePadState
GetState
(PlayerIndex playerIndex, GamePadDeadZone deadZoneMode) Gets the current state of a game pad controller, using a specified dead zone on analog stick positions.
Parameters: - playerIndex (Microsoft.Xna.Framework.PlayerIndex) – Player index for the controller you want to query.
- deadZoneMode (Microsoft.Xna.Framework.Input.GamePadDeadZone) – Enumerated value that specifies what dead zone type to use.
Returns: The state of the controller.
-
public GamePadState
GetState
(int index, GamePadDeadZone deadZoneMode) Gets the current state of a game pad controller, using a specified dead zone on analog stick positions.
Parameters: - index (int) – Index for the controller you want to query.
- deadZoneMode (Microsoft.Xna.Framework.Input.GamePadDeadZone) – Enumerated value that specifies what dead zone type to use.
Returns: The state of the controller.
-
public bool
SetVibration
(PlayerIndex playerIndex, float leftMotor, float rightMotor) Sets the vibration motor speeds on the controller device if supported.
Parameters: - playerIndex (Microsoft.Xna.Framework.PlayerIndex) – Player index that identifies the controller to set.
- leftMotor (float) – The speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
- rightMotor (float) – The speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.
Returns: Returns true if the vibration motors were set.
-
public bool
SetVibration
(int index, float leftMotor, float rightMotor) Sets the vibration motor speeds on the controller device if supported.
Parameters: - index (int) – Index for the controller you want to query.
- leftMotor (float) – The speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
- rightMotor (float) – The speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.
Returns: Returns true if the vibration motors were set.
-
readonly int