---
name: "SDL_VirtualJoystickDesc"
section: "3type"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_VirtualJoystickDesc"
---

# SDL\_VirtualJoystickDesc(3type)

The structure that describes a virtual joystick.

## NAME

SDL\_VirtualJoystickDesc - The structure that describes a virtual joystick.

## HEADER FILE

Defined in SDL3/SDL\_joystick.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**typedef struct SDL\_VirtualJoystickDesc** **{**     **Uint32 version;     /\*\*\< the version of this interface \*/**     **Uint16 type;        /\*\*\< \`SDL\_JoystickType\` \*/**     **Uint16 padding;     /\*\*\< unused \*/**     **Uint16 vendor\_id;   /\*\*\< the USB vendor ID of this joystick \*/**     **Uint16 product\_id;  /\*\*\< the USB product ID of this joystick \*/**     **Uint16 naxes;       /\*\*\< the number of axes on this joystick \*/**     **Uint16 nbuttons;    /\*\*\< the number of buttons on this joystick \*/**     **Uint16 nballs;      /\*\*\< the number of balls on this joystick \*/**     **Uint16 nhats;       /\*\*\< the number of hats on this joystick \*/**     **Uint16 ntouchpads;  /\*\*\< the number of touchpads on this joystick, requires \`touchpads\` to point at valid descriptions \*/**     **Uint16 nsensors;    /\*\*\< the number of sensors on this joystick, requires \`sensors\` to point at valid descriptions \*/**     **Uint16 padding2\[2\]; /\*\*\< unused \*/**     **Uint32 button\_mask; /\*\*\< A mask of which buttons are valid for this controller**                              **e.g. (1 \<\< SDL\_GAMEPAD\_BUTTON\_SOUTH) \*/**     **Uint32 axis\_mask;   /\*\*\< A mask of which axes are valid for this controller**                              **e.g. (1 \<\< SDL\_GAMEPAD\_AXIS\_LEFTX) \*/**     **const char \*name;   /\*\*\< the name of the joystick \*/**     **const SDL\_VirtualJoystickTouchpadDesc \*touchpads;   /\*\*\< A pointer to an array of touchpad descriptions, required if \`ntouchpads\` is \> 0 \*/**     **const SDL\_VirtualJoystickSensorDesc \*sensors;       /\*\*\< A pointer to an array of sensor descriptions, required if \`nsensors\` is \> 0 \*/**     **void \*userdata;     /\*\*\< User data pointer passed to callbacks \*/**     **void (SDLCALL \*Update)(void \*userdata); /\*\*\< Called when the joystick state should be updated \*/**     **void (SDLCALL \*SetPlayerIndex)(void \*userdata, int player\_index); /\*\*\< Called when the player index is set \*/**     **bool (SDLCALL \*Rumble)(void \*userdata, Uint16 low\_frequency\_rumble, Uint16 high\_frequency\_rumble); /\*\*\< Implements SDL\_RumbleJoystick() \*/**     **bool (SDLCALL \*RumbleTriggers)(void \*userdata, Uint16 left\_rumble, Uint16 right\_rumble); /\*\*\< Implements SDL\_RumbleJoystickTriggers() \*/**     **bool (SDLCALL \*SetLED)(void \*userdata, Uint8 red, Uint8 green, Uint8 blue); /\*\*\< Implements SDL\_SetJoystickLED() \*/**     **bool (SDLCALL \*SendEffect)(void \*userdata, const void \*data, int size); /\*\*\< Implements SDL\_SendJoystickEffect() \*/**     **bool (SDLCALL \*SetSensorsEnabled)(void \*userdata, bool enabled); /\*\*\< Implements SDL\_SetGamepadSensorEnabled() \*/**     **void (SDLCALL \*Cleanup)(void \*userdata); /\*\*\< Cleans up the userdata when the joystick is detached \*/** **} SDL\_VirtualJoystickDesc;**

## DESCRIPTION

This structure should be initialized using

**SDL\_INIT\_INTERFACE** (). All elements of this structure are optional.

## AVAILABILITY

This struct is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_AttachVirtualJoystick**(3)](/SDL_AttachVirtualJoystick/3.md), **•**(3), [**SDL\_INIT\_INTERFACE**(3)](/SDL_INIT_INTERFACE/3.md), **•**(3), [**SDL\_VirtualJoystickSensorDesc**(3type)](/SDL_VirtualJoystickSensorDesc/3type.md), **•**(3), [**SDL\_VirtualJoystickTouchpadDesc**(3type)](/SDL_VirtualJoystickTouchpadDesc/3type.md)
