GamePad.GetState Method (PlayerIndex, GamePadDeadZone)
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
public static GamePadState GetState ( PlayerIndex playerIndex, GamePadDeadZone deadZoneMode )
|InvalidOperationException||An unknown error has occurred. Verify that the correct playerIndex is being requested.|
When you call GetState, check the returned structure's IsConnected property value. If the controller has been disconnected, this value will be false. When a controller is disconnected, values for its state will not be valid. Also, the controller will not receive any new vibration settings.
The deadZoneMode parameter specifies the type of dead-zone processing to apply to the analog sticks on the controller. By applying a dead zone, controller inputs will report values near the center and edges of their ranges more accurately. If you wish to do your own dead-zone processing, use GamePadDeadZone.None.
Determining If an Xbox 360 Controller Is Disconnected (Xbox 360, Windows)