Documentation  

Last Update: Dec 2012

Gamepad Structure (SharpDX.XInput)

Describes the current state of the Xbox 360 Controller.


Assembly: SharpDX.XInput (SharpDX.XInput.dll 2.4.2.0)
Namespace: SharpDX.XInput
Unmanaged: XINPUT_GAMEPAD
Documentation for unmanaged references are generated from MSDN documentation. Please refer to the original documentation for further details.
  • C#
  • VB
  • C++
  • F#
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)]
public struct Gamepad

Syntax for VB is not yet implemented.

Syntax for C++ is not yet implemented

Syntax for F# is not yet implemented.

The Gamepad type exposes the following members.

  Platforms Name Unmanaged Description
TriggerThreshold Constant TriggerThreshold. 
LeftThumbDeadZone Constant LeftThumbDeadZone. 
RightThumbDeadZone Constant RightThumbDeadZone. 
Buttons XINPUT_GAMEPAD_BUTTON_FLAGS wButtons
Bitmask of the device digital buttons, as follows. A set bit indicates that the corresponding button is pressed.
#define DPadUp          0x00000001	
            #define DPadDown        0x00000002	
            #define DPadLeft        0x00000004	
            #define DPadRight       0x00000008	
            #define Start            0x00000010	
            #define Back             0x00000020	
            #define LeftThumb       0x00000040	
            #define RightThumb      0x00000080	
            #define LeftShoulder    0x0100	
            #define RightShoulder   0x0200	
            #define A                0x1000	
            #define B                0x2000	
            #define X                0x4000	
            #define Y                0x8000

Bits that are set but not defined above are reserved, and their state is undefined.

 
LeftTrigger unsigned char bLeftTrigger
The current value of the left trigger analog control. The value is between 0 and 255.
 
RightTrigger unsigned char bRightTrigger
The current value of the right trigger analog control. The value is between 0 and 255.
 
LeftThumbX short sThumbLX
Left thumbstick x-axis value. Each of the thumbstick axis members is a signed value between -32768 and 32767 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 constants LeftThumbDeadZone or RightThumbDeadZone can be used as a positive and negative value to filter a thumbstick input.
 
LeftThumbY short sThumbLY
Left thumbstick y-axis value. The value is between -32768 and 32767.
 
RightThumbX short sThumbRX
Right thumbstick x-axis value. The value is between -32768 and 32767.
 
RightThumbY short sThumbRY
Right thumbstick y-axis value. The value is between -32768 and 32767.
 
Top
  Platforms Name Description
ToString Returns the fully qualified type name of this instance. (Overrides ValueType.ToString())
Top

This structure is used by the State structure when polling for changes in the state of the controller.

The specific mapping of button to game function varies depending on the game type.

The constant XINPUT_GAMEPAD_TRIGGER_THRESHOLD may be used as the value which bLeftTrigger and bRightTrigger must be greater than to register as pressed. This is optional, but often desirable. Xbox 360 Controller buttons do not manifest crosstalk.

Supported in:

    
 All Windows Desktop - .NET 2.0+ - .NET 4.0+
    
 Windows 8 Metro - DirectX11.1 - .NET 4.5 Core
    
 Windows 8 Desktop - DirectX11.1 - .NET 4.0+