Struct sdl2::controller::GameController
source · [−]pub struct GameController { /* private fields */ }
Expand description
Wrapper around the SDL_GameController
object
Implementations
sourceimpl GameController
impl GameController
pub fn subsystem(&self) -> &GameControllerSubsystem
sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Return the name of the controller or an empty string if no name is found.
sourcepub fn mapping(&self) -> String
pub fn mapping(&self) -> String
Return a String describing the controller’s button and axis mappings
sourcepub fn attached(&self) -> bool
pub fn attached(&self) -> bool
Return true if the controller has been opened and currently connected.
sourcepub fn instance_id(&self) -> u32
pub fn instance_id(&self) -> u32
Return the joystick instance id of this controller
Returns true
if button
is pressed.
sourcepub fn set_rumble(
&mut self,
low_frequency_rumble: u16,
high_frequency_rumble: u16,
duration_ms: u32
) -> Result<(), IntegerOrSdlError>
pub fn set_rumble(
&mut self,
low_frequency_rumble: u16,
high_frequency_rumble: u16,
duration_ms: u32
) -> Result<(), IntegerOrSdlError>
Set the rumble motors to their specified intensities, if supported.
Automatically resets back to zero after duration_ms
milliseconds have passed.
Notes
The value range for the intensities is 0 to 0xFFFF.
Do not use std::u32::MAX
or similar for duration_ms
if you want
the rumble effect to keep playing for a long time, as this results in
the effect ending immediately after starting due to an overflow.
Use some smaller, “huge enough” number instead.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for GameController
impl !Send for GameController
impl !Sync for GameController
impl Unpin for GameController
impl UnwindSafe for GameController
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more