Skip to content

Commit ea04bdb

Browse files
committed
docs: Added a note about virtual joysticks to CategoryJoystick.
Fixes libsdl-org/sdlwiki#78
1 parent c663b6e commit ea04bdb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

include/SDL3/SDL_joystick.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
* instead.
3030
*
3131
* The term "instance_id" is the current instantiation of a joystick device in
32-
* the system, if the joystick is removed and then re-inserted then it will
33-
* get a new instance_id, instance_id's are monotonically increasing
32+
* the system. If the joystick is removed and then re-inserted then it will
33+
* get a new instance_id. instance_id's are monotonically increasing
3434
* identifiers of a joystick plugged in.
3535
*
3636
* The term "player_index" is the number assigned to a player on a specific
@@ -48,6 +48,14 @@
4848
* If you would like to receive joystick updates while the application is in
4949
* the background, you should set the following hint before calling
5050
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
51+
*
52+
* SDL can provide virtual joysticks as well: the app defines an imaginary
53+
* controller with SDL_AttachVirtualJoystick(), and then can provide inputs
54+
* for it via SDL_SetJoystickVirtualAxis(), SDL_SetJoystickVirtualButton(),
55+
* etc. As this data is supplied, it will look like a normal joystick to SDL,
56+
* just not backed by a hardware driver. This has been used to make unusual
57+
* devices, like VR headset controllers, look like normal joysticks, or
58+
* provide recording/playback of game inputs, etc.
5159
*/
5260

5361
#ifndef SDL_joystick_h_

0 commit comments

Comments
 (0)