Dela via


GamePadState.IsButtonDown Method

Determines whether specified input device buttons are pressed in this GamePadState.

Syntax

'Declaration
Public Function IsButtonDown ( _
         button As Buttons _
) As Boolean 
public bool IsButtonDown (
         Buttons button
)
public:
bool IsButtonDown(
         Buttons button
)

Parameters

  • button
    Type: Buttons
    Buttons to query. Specify a single button, or combine multiple buttons using a bitwise OR operation.

Return Value

Type: Boolean
true if all specified buttons are pressed; false otherwise.

Remarks

For digital buttons (such as A, START, and right bumper) the return value indicates whether the button is pressed.

For analog inputs (triggers and thumbsticks), the return value indicates whether the input exceeds dead zone values. For example, a trigger will not be reported as pressed until it is pulled about 12% of its full range. IsButtonDown always uses the default dead zone processing mode, GamePadDeadZone.IndependentAxes.

If multiple buttons are specified (by combining them using the bitwise OR operator), then all must be pressed (or exceed dead zone values) in order for IsButtonDown to return true.

Requirements

Namespace: Microsoft.Xna.Framework.Input

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

See Also

Reference

GamePadState Structure
GamePadState Members
Microsoft.Xna.Framework.Input Namespace
GamePadState.IsButtonDown Method
GamePad.GetState Method
GamePadDeadZone

Platforms

Windows Phone