共用方式為


GamePad.GetState Method

Gets the current state of an Xbox 360 Controller, optionally specifying a dead zone processing method for the analog sticks.

Overload List

Name Description
GamePad.GetState (PlayerIndex) Gets the current state of an Xbox 360 Controller.
GamePad.GetState (PlayerIndex, GamePadDeadZone) Gets the current state of an Xbox 360 Controller, using a specified dead zone on analog stick positions.

Remarks

When calling 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. The controller will also not be able to receive new vibration settings.

See Also

Tasks

How to: Detect Whether a Controller Button Is Pressed
How to: Detect Whether a Controller Is Disconnected

Concepts

Input Overview

Reference

GamePad Class
GamePad Members
Microsoft.Xna.Framework.Input Namespace