Class GamePad
Supports querying the game controllers and setting the vibration motors.
public static class GamePad
- Inheritance
-
GamePad
- Inherited Members
Properties
MaximumGamePadCount
The maximum number of game pads supported on this system.
public static int MaximumGamePadCount { get; }
Property Value
Methods
GetCapabilities(PlayerIndex)
Returns the capabilities of the connected controller.
public static GamePadCapabilities GetCapabilities(PlayerIndex playerIndex)
Parameters
playerIndex
PlayerIndexPlayer index for the controller you want to query.
Returns
- GamePadCapabilities
The capabilities of the controller.
GetCapabilities(int)
Returns the capabilities of the connected controller.
public static GamePadCapabilities GetCapabilities(int index)
Parameters
index
intIndex for the controller you want to query.
Returns
- GamePadCapabilities
The capabilities of the controller.
GetState(PlayerIndex)
Gets the current state of a game pad controller with an independent axes dead zone.
public static GamePadState GetState(PlayerIndex playerIndex)
Parameters
playerIndex
PlayerIndexPlayer index for the controller you want to query.
Returns
- GamePadState
The state of the controller.
GetState(PlayerIndex, GamePadDeadZone)
Gets the current state of a game pad controller, using a specified dead zone on analog stick positions.
public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone deadZoneMode)
Parameters
playerIndex
PlayerIndexPlayer index for the controller you want to query.
deadZoneMode
GamePadDeadZoneEnumerated value that specifies what dead zone type to use.
Returns
- GamePadState
The state of the controller.
GetState(PlayerIndex, GamePadDeadZone, GamePadDeadZone)
Gets the current state of a game pad controller, using a specified dead zone on analog stick positions.
public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone leftDeadZoneMode, GamePadDeadZone rightDeadZoneMode)
Parameters
playerIndex
PlayerIndexPlayer index for the controller you want to query.
leftDeadZoneMode
GamePadDeadZoneEnumerated value that specifies what dead zone type to use for the left stick.
rightDeadZoneMode
GamePadDeadZoneEnumerated value that specifies what dead zone type to use for the right stick.
Returns
- GamePadState
The state of the controller.
GetState(int)
Gets the current state of a game pad controller with an independent axes dead zone.
public static GamePadState GetState(int index)
Parameters
index
intIndex for the controller you want to query.
Returns
- GamePadState
The state of the controller.
GetState(int, GamePadDeadZone)
Gets the current state of a game pad controller, using a specified dead zone on analog stick positions.
public static GamePadState GetState(int index, GamePadDeadZone deadZoneMode)
Parameters
index
intIndex for the controller you want to query.
deadZoneMode
GamePadDeadZoneEnumerated value that specifies what dead zone type to use.
Returns
- GamePadState
The state of the controller.
GetState(int, GamePadDeadZone, GamePadDeadZone)
Gets the current state of a game pad controller, using a specified dead zone on analog stick positions.
public static GamePadState GetState(int index, GamePadDeadZone leftDeadZoneMode, GamePadDeadZone rightDeadZoneMode)
Parameters
index
intIndex for the controller you want to query.
leftDeadZoneMode
GamePadDeadZoneEnumerated value that specifies what dead zone type to use for the left stick.
rightDeadZoneMode
GamePadDeadZoneEnumerated value that specifies what dead zone type to use for the right stick.
Returns
- GamePadState
The state of the controller.
InitDatabase()
Initialies the internal database of gamepad mappings for an SDL context
public static void InitDatabase()
SetVibration(PlayerIndex, float, float)
Sets the vibration motor speeds on the controller device if supported.
public static bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor)
Parameters
playerIndex
PlayerIndexPlayer index that identifies the controller to set.
leftMotor
floatThe speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
rightMotor
floatThe speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.
Returns
- bool
Returns true if the vibration motors were set.
SetVibration(PlayerIndex, float, float, float, float)
Sets the vibration motor speeds on the controller device if supported.
public static bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor, float leftTrigger, float rightTrigger)
Parameters
playerIndex
PlayerIndexPlayer index that identifies the controller to set.
leftMotor
floatThe speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
rightMotor
floatThe speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.
leftTrigger
float(Xbox One controller only) The speed of the left trigger motor, between 0.0 and 1.0. This motor is a high-frequency motor.
rightTrigger
float(Xbox One controller only) The speed of the right trigger motor, between 0.0 and 1.0. This motor is a high-frequency motor.
Returns
- bool
Returns true if the vibration motors were set.
SetVibration(int, float, float)
Sets the vibration motor speeds on the controller device if supported.
public static bool SetVibration(int index, float leftMotor, float rightMotor)
Parameters
index
intIndex for the controller you want to query.
leftMotor
floatThe speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
rightMotor
floatThe speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.
Returns
- bool
Returns true if the vibration motors were set.
SetVibration(int, float, float, float, float)
Sets the vibration motor speeds on the controller device if supported.
public static bool SetVibration(int index, float leftMotor, float rightMotor, float leftTrigger, float rightTrigger)
Parameters
index
intIndex for the controller you want to query.
leftMotor
floatThe speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
rightMotor
floatThe speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.
leftTrigger
float(Xbox One controller only) The speed of the left trigger motor, between 0.0 and 1.0. This motor is a high-frequency motor.
rightTrigger
float(Xbox One controller only) The speed of the right trigger motor, between 0.0 and 1.0. This motor is a high-frequency motor.
Returns
- bool
Returns true if the vibration motors were set.