sdl.joystick

SDL Joystick Handling

Members

Aliases

SDL_JoystickID
alias SDL_JoystickID = Uint32

This is a unique ID for a joystick for the time it is connected to the system, and is never reused for the lifetime of the application.

Enums

SDL_JoystickConnectionState
enum SDL_JoystickConnectionState

Possible connection states for a joystick device.

SDL_JoystickType
enum SDL_JoystickType

An enum of some common joystick types.

Functions

SDL_AttachVirtualJoystick
SDL_JoystickID SDL_AttachVirtualJoystick(SDL_VirtualJoystickDesc* desc)

Attach a new virtual joystick.

SDL_CloseJoystick
void SDL_CloseJoystick(SDL_Joystick* joystick)

Close a joystick previously opened with SDL_OpenJoystick().

SDL_DetachVirtualJoystick
bool SDL_DetachVirtualJoystick(SDL_JoystickID instance_id)

Detach a virtual joystick.

SDL_GetJoystickAxis
Sint16 SDL_GetJoystickAxis(SDL_Joystick* joystick, int axis)

Get the current state of an axis control on a joystick.

SDL_GetJoystickAxisInitialState
bool SDL_GetJoystickAxisInitialState(SDL_Joystick* joystick, int axis, Sint16* state)

Get the initial state of an axis control on a joystick.

SDL_GetJoystickBall
bool SDL_GetJoystickBall(SDL_Joystick* joystick, int ball, int* dx, int* dy)

Get the ball axis change since the last poll.

SDL_GetJoystickButton
bool SDL_GetJoystickButton(SDL_Joystick* joystick, int button)

Get the current state of a button on a joystick.

SDL_GetJoystickConnectionState
SDL_JoystickConnectionState SDL_GetJoystickConnectionState(SDL_Joystick* joystick)

Get the connection state of a joystick.

SDL_GetJoystickFirmwareVersion
Uint16 SDL_GetJoystickFirmwareVersion(SDL_Joystick* joystick)

Get the firmware version of an opened joystick, if available.

SDL_GetJoystickFromID
SDL_Joystick* SDL_GetJoystickFromID(SDL_JoystickID instance_id)

Get the SDL_Joystick associated with an instance ID, if it has been opened.

SDL_GetJoystickFromPlayerIndex
SDL_Joystick* SDL_GetJoystickFromPlayerIndex(int player_index)

Get the SDL_Joystick associated with a player index.

SDL_GetJoystickGUID
SDL_GUID SDL_GetJoystickGUID(SDL_Joystick* joystick)

Get the implementation-dependent GUID for the joystick.

SDL_GetJoystickGUIDForID
SDL_GUID SDL_GetJoystickGUIDForID(SDL_JoystickID instance_id)

Get the implementation-dependent GUID of a joystick.

SDL_GetJoystickGUIDInfo
void SDL_GetJoystickGUIDInfo(SDL_GUID guid, Uint16* vendor, Uint16* product, Uint16* version_, Uint16* crc16)

Get the device information encoded in a SDL_GUID structure.

SDL_GetJoystickHat
Uint8 SDL_GetJoystickHat(SDL_Joystick* joystick, int hat)

Get the current state of a POV hat on a joystick.

SDL_GetJoystickID
SDL_JoystickID SDL_GetJoystickID(SDL_Joystick* joystick)

Get the instance ID of an opened joystick.

SDL_GetJoystickName
const(char)* SDL_GetJoystickName(SDL_Joystick* joystick)

Get the implementation dependent name of a joystick.

SDL_GetJoystickNameForID
const(char)* SDL_GetJoystickNameForID(SDL_JoystickID instance_id)

Get the implementation dependent name of a joystick.

SDL_GetJoystickPath
const(char)* SDL_GetJoystickPath(SDL_Joystick* joystick)

Get the implementation dependent path of a joystick.

SDL_GetJoystickPathForID
const(char)* SDL_GetJoystickPathForID(SDL_JoystickID instance_id)

Get the implementation dependent path of a joystick.

SDL_GetJoystickPlayerIndex
int SDL_GetJoystickPlayerIndex(SDL_Joystick* joystick)

Get the player index of an opened joystick.

SDL_GetJoystickPlayerIndexForID
int SDL_GetJoystickPlayerIndexForID(SDL_JoystickID instance_id)

Get the player index of a joystick.

SDL_GetJoystickPowerInfo
SDL_PowerState SDL_GetJoystickPowerInfo(SDL_Joystick* joystick, int* percent)

Get the battery state of a joystick.

SDL_GetJoystickProduct
Uint16 SDL_GetJoystickProduct(SDL_Joystick* joystick)

Get the USB product ID of an opened joystick, if available.

SDL_GetJoystickProductForID
Uint16 SDL_GetJoystickProductForID(SDL_JoystickID instance_id)

Get the USB product ID of a joystick, if available.

SDL_GetJoystickProductVersion
Uint16 SDL_GetJoystickProductVersion(SDL_Joystick* joystick)

Get the product version of an opened joystick, if available.

SDL_GetJoystickProductVersionForID
Uint16 SDL_GetJoystickProductVersionForID(SDL_JoystickID instance_id)

Get the product version of a joystick, if available.

SDL_GetJoystickProperties
SDL_PropertiesID SDL_GetJoystickProperties(SDL_Joystick* joystick)

Get the properties associated with a joystick.

SDL_GetJoystickSerial
const(char)* SDL_GetJoystickSerial(SDL_Joystick* joystick)

Get the serial number of an opened joystick, if available.

SDL_GetJoystickType
SDL_JoystickType SDL_GetJoystickType(SDL_Joystick* joystick)

Get the type of an opened joystick.

SDL_GetJoystickTypeForID
SDL_JoystickType SDL_GetJoystickTypeForID(SDL_JoystickID instance_id)

Get the type of a joystick, if available.

SDL_GetJoystickVendor
Uint16 SDL_GetJoystickVendor(SDL_Joystick* joystick)

Get the USB vendor ID of an opened joystick, if available.

SDL_GetJoystickVendorForID
Uint16 SDL_GetJoystickVendorForID(SDL_JoystickID instance_id)

Get the USB vendor ID of a joystick, if available.

SDL_GetJoysticks
SDL_JoystickID* SDL_GetJoysticks(int* count)

Get a list of currently connected joysticks.

SDL_GetNumJoystickAxes
int SDL_GetNumJoystickAxes(SDL_Joystick* joystick)

Get the number of general axis controls on a joystick.

SDL_GetNumJoystickBalls
int SDL_GetNumJoystickBalls(SDL_Joystick* joystick)

Get the number of trackballs on a joystick.

SDL_GetNumJoystickButtons
int SDL_GetNumJoystickButtons(SDL_Joystick* joystick)

Get the number of buttons on a joystick.

SDL_GetNumJoystickHats
int SDL_GetNumJoystickHats(SDL_Joystick* joystick)

Get the number of POV hats on a joystick.

SDL_HasJoystick
bool SDL_HasJoystick()

Return whether a joystick is currently connected.

SDL_IsJoystickVirtual
bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id)

Query whether or not a joystick is virtual.

SDL_JoystickConnected
bool SDL_JoystickConnected(SDL_Joystick* joystick)

Get the status of a specified joystick.

SDL_JoystickEventsEnabled
bool SDL_JoystickEventsEnabled()

Query the state of joystick event processing.

SDL_LockJoysticks
void SDL_LockJoysticks()

Locking for atomic access to the joystick API.

SDL_OpenJoystick
SDL_Joystick* SDL_OpenJoystick(SDL_JoystickID instance_id)

Open a joystick for use.

SDL_RumbleJoystick
bool SDL_RumbleJoystick(SDL_Joystick* joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)

Start a rumble effect.

SDL_RumbleJoystickTriggers
bool SDL_RumbleJoystickTriggers(SDL_Joystick* joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)

Start a rumble effect in the joystick's triggers.

SDL_SendJoystickEffect
bool SDL_SendJoystickEffect(SDL_Joystick* joystick, void* data, int size)

Send a joystick specific effect packet.

SDL_SendJoystickVirtualSensorData
bool SDL_SendJoystickVirtualSensorData(SDL_Joystick* joystick, SDL_SensorType type, Uint64 sensor_timestamp, float* data, int num_values)

Send a sensor update for an opened virtual joystick.

SDL_SetJoystickEventsEnabled
void SDL_SetJoystickEventsEnabled(bool enabled)

Set the state of joystick event processing.

SDL_SetJoystickLED
bool SDL_SetJoystickLED(SDL_Joystick* joystick, Uint8 red, Uint8 green, Uint8 blue)

Update a joystick's LED color.

SDL_SetJoystickPlayerIndex
bool SDL_SetJoystickPlayerIndex(SDL_Joystick* joystick, int player_index)

Set the player index of an opened joystick.

SDL_SetJoystickVirtualAxis
bool SDL_SetJoystickVirtualAxis(SDL_Joystick* joystick, int axis, Sint16 value)

Set the state of an axis on an opened virtual joystick.

SDL_SetJoystickVirtualBall
bool SDL_SetJoystickVirtualBall(SDL_Joystick* joystick, int ball, Sint16 xrel, Sint16 yrel)

Generate ball motion on an opened virtual joystick.

SDL_SetJoystickVirtualButton
bool SDL_SetJoystickVirtualButton(SDL_Joystick* joystick, int button, bool down)

Set the state of a button on an opened virtual joystick.

SDL_SetJoystickVirtualHat
bool SDL_SetJoystickVirtualHat(SDL_Joystick* joystick, int hat, Uint8 value)

Set the state of a hat on an opened virtual joystick.

SDL_SetJoystickVirtualTouchpad
bool SDL_SetJoystickVirtualTouchpad(SDL_Joystick* joystick, int touchpad, int finger, bool down, float x, float y, float pressure)

Set touchpad finger state on an opened virtual joystick.

SDL_UnlockJoysticks
void SDL_UnlockJoysticks()

Unlocking for atomic access to the joystick API.

SDL_UpdateJoysticks
void SDL_UpdateJoysticks()

Update the current state of the open joysticks.

Manifest constants

SDL_JOYSTICK_AXIS_MAX
enum SDL_JOYSTICK_AXIS_MAX;

The largest value an SDL_Joystick's axis can report.

SDL_JOYSTICK_AXIS_MIN
enum SDL_JOYSTICK_AXIS_MIN;

The smallest value an SDL_Joystick's axis can report.

SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN
enum SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN
enum SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN
enum SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN
enum SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN
enum SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Structs

SDL_Joystick
struct SDL_Joystick

The joystick structure used to identify an SDL joystick.

SDL_VirtualJoystickDesc
struct SDL_VirtualJoystickDesc

The structure that describes a virtual joystick.

SDL_VirtualJoystickSensorDesc
struct SDL_VirtualJoystickSensorDesc

The structure that describes a virtual joystick sensor.

SDL_VirtualJoystickTouchpadDesc
struct SDL_VirtualJoystickTouchpadDesc

The structure that describes a virtual joystick touchpad.

Variables

SDL_HAT_CENTERED
enum Uint8 SDL_HAT_CENTERED;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_HAT_DOWN
enum Uint8 SDL_HAT_DOWN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_HAT_LEFT
enum Uint8 SDL_HAT_LEFT;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_HAT_LEFTDOWN
enum Uint8 SDL_HAT_LEFTDOWN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_HAT_LEFTUP
enum Uint8 SDL_HAT_LEFTUP;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_HAT_RIGHT
enum Uint8 SDL_HAT_RIGHT;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_HAT_RIGHTDOWN
enum Uint8 SDL_HAT_RIGHTDOWN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_HAT_RIGHTUP
enum Uint8 SDL_HAT_RIGHTUP;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
SDL_HAT_UP
enum Uint8 SDL_HAT_UP;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

See Also

Meta

License

Subject to the terms of the Zlib License, as written in the LICENSE file.

Authors

Luna Nielsen