pub struct GameControllerSubsystem { /* private fields */ }

Implementations§

source§

impl GameControllerSubsystem

source

pub fn num_joysticks(&self) -> Result<u32, String>

Retrieve the total number of attached joysticks and controllers identified by SDL.

source

pub fn is_game_controller(&self, joystick_index: u32) -> bool

Return true if the joystick at index joystick_index is a game controller.

source

pub fn open( &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.

source

pub fn name_for_index( &self, joystick_index: u32 ) -> Result<String, IntegerOrSdlError>

Return the name of the controller at index joystick_index.

source

pub fn set_event_state(&self, state: bool)

If state is true controller events are processed, otherwise they’re ignored.

source

pub fn event_state(&self) -> bool

Return true if controller events are processed.

source

pub fn add_mapping( &self, mapping: &str ) -> Result<MappingStatus, AddMappingError>

Add a new controller input mapping from a mapping string.

source

pub fn load_mappings<P: AsRef<Path>>( &self, path: P ) -> Result<i32, AddMappingError>

Load controller input mappings from a file.

source

pub fn load_mappings_from_read<R: Read>( &self, read: &mut R ) -> Result<i32, AddMappingError>

Load controller input mappings from a Read object.

source

pub fn load_mappings_from_rw<'a>( &self, rw: RWops<'a> ) -> Result<i32, AddMappingError>

Load controller input mappings from an SDL RWops object.

source

pub fn mapping_for_guid(&self, guid: Guid) -> Result<String, String>

source

pub fn update(&self)

Force controller update when not using the event loop

source§

impl GameControllerSubsystem

source

pub fn sdl(&self) -> Sdl

Obtain an SDL context.

Trait Implementations§

source§

impl Clone for GameControllerSubsystem

source§

fn clone(&self) -> GameControllerSubsystem

Returns a copy 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 GameControllerSubsystem

source§

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

Formats the value using the given formatter. Read more

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> 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.