Skip to main content

SDL_VirtualJoystickDesc

Struct SDL_VirtualJoystickDesc 

Source
#[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

§nbuttons: Uint16

< 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

§button_mask: Uint32

< 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

Source§

fn clone(&self) -> SDL_VirtualJoystickDesc

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SDL_VirtualJoystickDesc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SDL_VirtualJoystickDesc

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Hash for SDL_VirtualJoystickDesc

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Copy for SDL_VirtualJoystickDesc

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.