Table of Contents

Class Joystick

Namespace
Microsoft.Xna.Framework.Input
Assembly
MonoGame.Framework.dll

Allows interaction with joysticks. Unlike GamePad the number of Buttons/Axes/DPads is not limited.

public static class Joystick
Inheritance
Joystick
Inherited Members

Properties

IsSupported

Gets a value indicating whether the current platform supports reading raw joystick data.

public static bool IsSupported { get; }

Property Value

bool

true if the current platform supports reading raw joystick data; otherwise, false.

LastConnectedIndex

Gets a value indicating the last joystick index connected to the system. If this value is less than 0, no joysticks are connected.

The order joysticks are connected and disconnected determines their index. As such, this value may be larger than 0 even if only one joystick is connected.

public static int LastConnectedIndex { get; }

Property Value

int

Methods

GetCapabilities(int)

Gets the capabilities of the joystick.

public static JoystickCapabilities GetCapabilities(int index)

Parameters

index int

Index of the joystick you want to access.

Returns

JoystickCapabilities

The capabilities of the joystick.

GetState(ref JoystickState, int)

Gets the current state of the joystick by updating an existing JoystickState.

public static void GetState(ref JoystickState joystickState, int index)

Parameters

joystickState JoystickState

The JoystickState to update.

index int

Index of the joystick you want to access.

GetState(int)

Gets the current state of the joystick.

public static JoystickState GetState(int index)

Parameters

index int

Index of the joystick you want to access.

Returns

JoystickState

The state of the joystick.