pub struct GameControllerSubsystem { /* private fields */ }Implementations§
Source§impl GameControllerSubsystem
impl GameControllerSubsystem
Sourcepub fn num_joysticks(&self) -> Result<u32, String>
pub fn num_joysticks(&self) -> Result<u32, String>
Retreive the total number of attached joysticks and controllers identified by SDL.
Sourcepub fn is_game_controller(&self, id: u32) -> bool
pub fn is_game_controller(&self, id: u32) -> bool
Return true if the joystick at index id is a game controller.
Sourcepub fn open(&self, id: u32) -> Result<GameController, IntegerOrSdlError>
pub fn open(&self, id: u32) -> Result<GameController, IntegerOrSdlError>
Attempt to open the controller number id and return
it. Controller IDs are the same as joystick IDs and the
maximum number can be retreived using the SDL_NumJoysticks
function.
Sourcepub fn name_for_index(&self, index: u32) -> Result<String, IntegerOrSdlError>
pub fn name_for_index(&self, index: u32) -> Result<String, IntegerOrSdlError>
Return the name of the controller at the given index.
Sourcepub fn set_event_state(&self, state: bool)
pub fn set_event_state(&self, state: bool)
If state is true controller events are processed, otherwise
they’re ignored.
Sourcepub fn event_state(&self) -> bool
pub fn event_state(&self) -> bool
Return true if controller events are processed.
Sourcepub fn add_mapping(
&self,
mapping: &str,
) -> Result<MappingStatus, AddMappingError>
pub fn add_mapping( &self, mapping: &str, ) -> Result<MappingStatus, AddMappingError>
Add a new mapping from a mapping string
Sourcepub fn load_mappings<P>(&self, path: P) -> Result<i32, AddMappingError>
pub fn load_mappings<P>(&self, path: P) -> Result<i32, AddMappingError>
Load mappings from a file
pub fn mapping_for_guid(&self, guid: Guid) -> Result<String, String>
Trait Implementations§
Source§impl Clone for GameControllerSubsystem
impl Clone for GameControllerSubsystem
Source§fn clone(&self) -> GameControllerSubsystem
fn clone(&self) -> GameControllerSubsystem
Returns a duplicate 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 GameControllerSubsystem
impl RefUnwindSafe for GameControllerSubsystem
impl !Send for GameControllerSubsystem
impl !Sync for GameControllerSubsystem
impl Unpin for GameControllerSubsystem
impl UnwindSafe for GameControllerSubsystem
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