pub struct GamepadSubsystem { /* private fields */ }Implementations§
Source§impl GamepadSubsystem
impl GamepadSubsystem
Sourcepub fn num_gamepads(&self) -> Result<u32, Error>
pub fn num_gamepads(&self) -> Result<u32, Error>
Retrieve the total number of attached gamepads identified by SDL.
Sourcepub fn is_game_controller(&self, joystick_index: u32) -> bool
pub fn is_game_controller(&self, joystick_index: u32) -> bool
Return true if the joystick at index joystick_index is a game controller.
Sourcepub fn open(&self, joystick_index: u32) -> Result<Gamepad, IntegerOrSdlError>
pub fn open(&self, joystick_index: u32) -> Result<Gamepad, IntegerOrSdlError>
Attempt to open the controller at index joystick_index and return it.
Controller IDs are the same as joystick IDs and the maximum number can
be retrieved using the SDL_GetJoysticks function.
Sourcepub fn name_for_index(
&self,
joystick_index: u32,
) -> Result<String, IntegerOrSdlError>
pub fn name_for_index( &self, joystick_index: u32, ) -> Result<String, IntegerOrSdlError>
Return the name of the controller at index joystick_index.
Sourcepub fn add_mapping(
&self,
mapping: &str,
) -> Result<MappingStatus, AddMappingError>
pub fn add_mapping( &self, mapping: &str, ) -> Result<MappingStatus, AddMappingError>
Add a new controller input mapping from a mapping string.
Sourcepub fn load_mappings<P: AsRef<Path>>(
&self,
path: P,
) -> Result<i32, AddMappingError>
pub fn load_mappings<P: AsRef<Path>>( &self, path: P, ) -> Result<i32, AddMappingError>
Load controller input mappings from a file.
Sourcepub fn load_mappings_from_read<R: Read>(
&self,
read: &mut R,
) -> Result<i32, AddMappingError>
pub fn load_mappings_from_read<R: Read>( &self, read: &mut R, ) -> Result<i32, AddMappingError>
Load controller input mappings from a Read object.
Sourcepub fn load_mappings_from_rw(
&self,
rw: IOStream<'_>,
) -> Result<i32, AddMappingError>
pub fn load_mappings_from_rw( &self, rw: IOStream<'_>, ) -> Result<i32, AddMappingError>
Load controller input mappings from an SDL IOStream object.
pub fn mapping_for_guid(&self, guid: Guid) -> Result<String, Error>
Trait Implementations§
Source§impl Clone for GamepadSubsystem
impl Clone for GamepadSubsystem
Source§fn clone(&self) -> GamepadSubsystem
fn clone(&self) -> GamepadSubsystem
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GamepadSubsystem
impl RefUnwindSafe for GamepadSubsystem
impl !Send for GamepadSubsystem
impl !Sync for GamepadSubsystem
impl Unpin for GamepadSubsystem
impl UnwindSafe for GamepadSubsystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more