Skip to content

Commit dec2104

Browse files
committed
docs: Slightly improve virtual joystick docs.
Reference libsdl-org/sdlwiki#78
1 parent ea04bdb commit dec2104

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

include/SDL3/SDL_joystick.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,31 @@ SDL_COMPILE_TIME_ASSERT(SDL_VirtualJoystickDesc_SIZE,
477477
/**
478478
* Attach a new virtual joystick.
479479
*
480+
* Apps can create virtual joysticks, that exist without hardware directly
481+
* backing them, and have program-supplied inputs. Once attached, a virtual
482+
* joystick looks like any other joystick that SDL can access. These can be
483+
* used to make other things look like joysticks, or provide pre-recorded
484+
* input, etc.
485+
*
486+
* Once attached, the app can send joystick inputs to the new virtual joystick
487+
* using SDL_SetJoystickVirtualAxis(), etc.
488+
*
489+
* When no longer needed, the virtual joystick can be removed by calling
490+
* SDL_DetachVirtualJoystick().
491+
*
480492
* \param desc joystick description, initialized using SDL_INIT_INTERFACE().
481493
* \returns the joystick instance ID, or 0 on failure; call SDL_GetError() for
482494
* more information.
483495
*
484496
* \since This function is available since SDL 3.2.0.
485497
*
486498
* \sa SDL_DetachVirtualJoystick
499+
* \sa SDL_SetJoystickVirtualAxis
500+
* \sa SDL_SetJoystickVirtualButton
501+
* \sa SDL_SetJoystickVirtualBall
502+
* \sa SDL_SetJoystickVirtualHat
503+
* \sa SDL_SetJoystickVirtualTouchpad
504+
* \sa SDL_SetJoystickVirtualSensorData
487505
*/
488506
extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystick(const SDL_VirtualJoystickDesc *desc);
489507

@@ -531,6 +549,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instance_i
531549
* information.
532550
*
533551
* \since This function is available since SDL 3.2.0.
552+
*
553+
* \sa SDL_SetJoystickVirtualButton
554+
* \sa SDL_SetJoystickVirtualBall
555+
* \sa SDL_SetJoystickVirtualHat
556+
* \sa SDL_SetJoystickVirtualTouchpad
557+
* \sa SDL_SetJoystickVirtualSensorData
534558
*/
535559
extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
536560

@@ -551,6 +575,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joysti
551575
* information.
552576
*
553577
* \since This function is available since SDL 3.2.0.
578+
*
579+
* \sa SDL_SetJoystickVirtualAxis
580+
* \sa SDL_SetJoystickVirtualButton
581+
* \sa SDL_SetJoystickVirtualHat
582+
* \sa SDL_SetJoystickVirtualTouchpad
583+
* \sa SDL_SetJoystickVirtualSensorData
554584
*/
555585
extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystick, int ball, Sint16 xrel, Sint16 yrel);
556586

@@ -570,6 +600,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joysti
570600
* information.
571601
*
572602
* \since This function is available since SDL 3.2.0.
603+
*
604+
* \sa SDL_SetJoystickVirtualAxis
605+
* \sa SDL_SetJoystickVirtualBall
606+
* \sa SDL_SetJoystickVirtualHat
607+
* \sa SDL_SetJoystickVirtualTouchpad
608+
* \sa SDL_SetJoystickVirtualSensorData
573609
*/
574610
extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, bool down);
575611

@@ -589,6 +625,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joys
589625
* information.
590626
*
591627
* \since This function is available since SDL 3.2.0.
628+
*
629+
* \sa SDL_SetJoystickVirtualAxis
630+
* \sa SDL_SetJoystickVirtualButton
631+
* \sa SDL_SetJoystickVirtualBall
632+
* \sa SDL_SetJoystickVirtualTouchpad
633+
* \sa SDL_SetJoystickVirtualSensorData
592634
*/
593635
extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
594636

@@ -615,6 +657,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystic
615657
* information.
616658
*
617659
* \since This function is available since SDL 3.2.0.
660+
*
661+
* \sa SDL_SetJoystickVirtualAxis
662+
* \sa SDL_SetJoystickVirtualButton
663+
* \sa SDL_SetJoystickVirtualBall
664+
* \sa SDL_SetJoystickVirtualHat
665+
* \sa SDL_SetJoystickVirtualSensorData
618666
*/
619667
extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, bool down, float x, float y, float pressure);
620668

@@ -637,6 +685,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *jo
637685
* information.
638686
*
639687
* \since This function is available since SDL 3.2.0.
688+
*
689+
* \sa SDL_SetJoystickVirtualAxis
690+
* \sa SDL_SetJoystickVirtualButton
691+
* \sa SDL_SetJoystickVirtualBall
692+
* \sa SDL_SetJoystickVirtualHat
693+
* \sa SDL_SetJoystickVirtualTouchpad
640694
*/
641695
extern SDL_DECLSPEC bool SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values);
642696

0 commit comments

Comments
 (0)