[−][src]Struct sdl2::GameControllerSubsystem
Methods
impl GameControllerSubsystem
[src]
pub fn num_joysticks(&self) -> Result<u32, String>
[src]
Retrieve the total number of attached joysticks and controllers identified by SDL.
pub fn is_game_controller(&self, joystick_index: u32) -> bool
[src]
Return true if the joystick at index joystick_index
is a game controller.
pub fn open(
&self,
joystick_index: u32
) -> Result<GameController, IntegerOrSdlError>
[src]
&self,
joystick_index: u32
) -> Result<GameController, 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_NumJoysticks
function.
pub fn name_for_index(
&self,
joystick_index: u32
) -> Result<String, IntegerOrSdlError>
[src]
&self,
joystick_index: u32
) -> Result<String, IntegerOrSdlError>
Return the name of the controller at index joystick_index
.
pub fn set_event_state(&self, state: bool)
[src]
If state is true
controller events are processed, otherwise
they're ignored.
pub fn event_state(&self) -> bool
[src]
Return true
if controller events are processed.
pub fn add_mapping(
&self,
mapping: &str
) -> Result<MappingStatus, AddMappingError>
[src]
&self,
mapping: &str
) -> Result<MappingStatus, AddMappingError>
Add a new controller input mapping from a mapping string.
pub fn load_mappings<P: AsRef<Path>>(
&self,
path: P
) -> Result<i32, AddMappingError>
[src]
&self,
path: P
) -> Result<i32, AddMappingError>
Load controller input mappings from a file.
pub fn load_mappings_from_read<R: Read>(
&self,
read: &mut R
) -> Result<i32, AddMappingError>
[src]
&self,
read: &mut R
) -> Result<i32, AddMappingError>
Load controller input mappings from a Read
object.
pub fn load_mappings_from_rw<'a>(
&self,
rw: RWops<'a>
) -> Result<i32, AddMappingError>
[src]
&self,
rw: RWops<'a>
) -> Result<i32, AddMappingError>
Load controller input mappings from an SDL [RWops
] object.
pub fn mapping_for_guid(&self, guid: Guid) -> Result<String, String>
[src]
pub fn update(&self)
[src]
Force controller update when not using the event loop
impl GameControllerSubsystem
[src]
Trait Implementations
impl Clone for GameControllerSubsystem
[src]
fn clone(&self) -> GameControllerSubsystem
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for GameControllerSubsystem
[src]
Auto Trait Implementations
impl !RefUnwindSafe for GameControllerSubsystem
impl !Send for GameControllerSubsystem
impl !Sync for GameControllerSubsystem
impl Unpin for GameControllerSubsystem
impl !UnwindSafe for GameControllerSubsystem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,