#[repr(C)]pub struct SDL_VirtualJoystickDesc {Show 26 fields
pub version: Uint32,
pub type_: Uint16,
pub padding: Uint16,
pub vendor_id: Uint16,
pub product_id: Uint16,
pub naxes: Uint16,
pub nbuttons: Uint16,
pub nballs: Uint16,
pub nhats: Uint16,
pub ntouchpads: Uint16,
pub nsensors: Uint16,
pub padding2: [Uint16; 2],
pub button_mask: Uint32,
pub axis_mask: Uint32,
pub name: *const c_char,
pub touchpads: *const SDL_VirtualJoystickTouchpadDesc,
pub sensors: *const SDL_VirtualJoystickSensorDesc,
pub userdata: *mut c_void,
pub Update: Option<unsafe extern "C" fn(userdata: *mut c_void)>,
pub SetPlayerIndex: Option<unsafe extern "C" fn(userdata: *mut c_void, player_index: c_int)>,
pub Rumble: Option<unsafe extern "C" fn(userdata: *mut c_void, low_frequency_rumble: Uint16, high_frequency_rumble: Uint16) -> bool>,
pub RumbleTriggers: Option<unsafe extern "C" fn(userdata: *mut c_void, left_rumble: Uint16, right_rumble: Uint16) -> bool>,
pub SetLED: Option<unsafe extern "C" fn(userdata: *mut c_void, red: Uint8, green: Uint8, blue: Uint8) -> bool>,
pub SendEffect: Option<unsafe extern "C" fn(userdata: *mut c_void, data: *const c_void, size: c_int) -> bool>,
pub SetSensorsEnabled: Option<unsafe extern "C" fn(userdata: *mut c_void, enabled: bool) -> bool>,
pub Cleanup: Option<unsafe extern "C" fn(userdata: *mut c_void)>,
}Expand description
The structure that describes a virtual joystick.
This structure should be initialized using SDL_INIT_INTERFACE(). All elements of this structure are optional.
Available Since: This struct is available since SDL 3.2.0.
See Also: SDL_AttachVirtualJoystick See Also: SDL_INIT_INTERFACE See Also: SDL_VirtualJoystickSensorDesc See Also: SDL_VirtualJoystickTouchpadDesc
Fields§
§version: Uint32< the version of this interface
type_: Uint16< SDL_JoystickType
padding: Uint16< unused
vendor_id: Uint16< the USB vendor ID of this joystick
product_id: Uint16< the USB product ID of this joystick
naxes: Uint16< the number of axes on this joystick
< the number of buttons on this joystick
nballs: Uint16< the number of balls on this joystick
nhats: Uint16< the number of hats on this joystick
ntouchpads: Uint16< the number of touchpads on this joystick, requires touchpads to point at valid descriptions
nsensors: Uint16< the number of sensors on this joystick, requires sensors to point at valid descriptions
padding2: [Uint16; 2]< unused
< A mask of which buttons are valid for this controller e.g. (1 << SDL_GAMEPAD_BUTTON_SOUTH)
axis_mask: Uint32< A mask of which axes are valid for this controller e.g. (1 << SDL_GAMEPAD_AXIS_LEFTX)
name: *const c_char< the name of the joystick
touchpads: *const SDL_VirtualJoystickTouchpadDesc< A pointer to an array of touchpad descriptions, required if ntouchpads is > 0
sensors: *const SDL_VirtualJoystickSensorDesc< A pointer to an array of sensor descriptions, required if nsensors is > 0
userdata: *mut c_void< User data pointer passed to callbacks
Update: Option<unsafe extern "C" fn(userdata: *mut c_void)>< Called when the joystick state should be updated
SetPlayerIndex: Option<unsafe extern "C" fn(userdata: *mut c_void, player_index: c_int)>< Called when the player index is set
Rumble: Option<unsafe extern "C" fn(userdata: *mut c_void, low_frequency_rumble: Uint16, high_frequency_rumble: Uint16) -> bool>< Implements SDL_RumbleJoystick()
RumbleTriggers: Option<unsafe extern "C" fn(userdata: *mut c_void, left_rumble: Uint16, right_rumble: Uint16) -> bool>< Implements SDL_RumbleJoystickTriggers()
SetLED: Option<unsafe extern "C" fn(userdata: *mut c_void, red: Uint8, green: Uint8, blue: Uint8) -> bool>< Implements SDL_SetJoystickLED()
SendEffect: Option<unsafe extern "C" fn(userdata: *mut c_void, data: *const c_void, size: c_int) -> bool>< Implements SDL_SendJoystickEffect()
SetSensorsEnabled: Option<unsafe extern "C" fn(userdata: *mut c_void, enabled: bool) -> bool>< Implements SDL_SetGamepadSensorEnabled()
Cleanup: Option<unsafe extern "C" fn(userdata: *mut c_void)>< Cleans up the userdata when the joystick is detached
Trait Implementations§
Source§impl Clone for SDL_VirtualJoystickDesc
impl Clone for SDL_VirtualJoystickDesc
Source§fn clone(&self) -> SDL_VirtualJoystickDesc
fn clone(&self) -> SDL_VirtualJoystickDesc
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more