SDL Wiki
(This is the legacy documentation for stable SDL2, the current stable version; SDL3 is the current development version.)


Open a joystick for use.


SDL_Joystick* SDL_JoystickOpen(int device_index);

Function Parameters

device_index the index of the joystick to query

Return Value

Returns a joystick identifier or NULL if an error occurred; call SDL_GetError() for more information.


The device_index argument refers to the N'th joystick presently recognized by SDL on the system. It is NOT the same as the instance ID used to identify the joystick in future events. See SDL_JoystickInstanceID() for more details about instance IDs.

The joystick subsystem must be initialized before a joystick can be opened for use.


This function is available since SDL 2.0.0.


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.