pub struct Mapping {
buttons: VecMap<EvCode>,
axes: VecMap<EvCode>,
}
Expand description
Stores data used to map gamepad buttons and axes.
After you add all mappings, use
Gamepad::set_mapping(…)
to change mapping of
existing gamepad.
See examples/mapping.rs
for more detailed example.
Fields§
§axes: VecMap<EvCode>
Implementations§
source§impl MappingData
impl MappingData
Returns EvCode
associated with button index.
sourcepub fn insert_btn(&mut self, from: Code, to: Button) -> Option<Code>
pub fn insert_btn(&mut self, from: Code, to: Button) -> Option<Code>
Inserts new button mapping.
Removes button and returns associated NativEvCode
.
sourcepub fn remove_axis(&mut self, idx: Axis) -> Option<Code>
pub fn remove_axis(&mut self, idx: Axis) -> Option<Code>
Removes axis and returns associated NativEvCode
.
Trait Implementations§
source§impl Clone for MappingData
impl Clone for MappingData
source§fn clone(&self) -> MappingData
fn clone(&self) -> MappingData
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 moresource§impl Debug for MappingData
impl Debug for MappingData
source§impl Default for MappingData
impl Default for MappingData
source§fn default() -> MappingData
fn default() -> MappingData
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MappingData
impl RefUnwindSafe for MappingData
impl Send for MappingData
impl Sync for MappingData
impl Unpin for MappingData
impl UnwindSafe for MappingData
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