共用方式為


GamePadThumbSticks.Left Property

Returns the position of the left Xbox 360 Controller stick (thumbstick) as a 2D vector.

Namespace: Microsoft.Xna.Framework.Input
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public Vector2 Left { get; }

Property Value

Two-dimensional vector that identifies the position of the left stick. Each axis is represented as a floating-point value from −1.0 to 1.0.

Remarks

Each of the thumbstick axis members is a signed value describing the position of the thumbstick. A value of 0 is centered. Negative values signify down or to the left. Positive values signify up or to the right. The controller typically does not generate thumbstick values within a dead zone, or marginal input region around the center position.

Example

if (GamePad.GetState( PlayerIndex.One ).ThumbSticks.Left.Y == 1.0f)
{
// Player one has pressed the left thumbstick up.
}
      

See Also

Reference

GamePadThumbSticks Structure
GamePadThumbSticks Members
Microsoft.Xna.Framework.Input Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista