[−][src]Struct amethyst_input::Bindings
Used for saving and loading input settings.
An action can either be a single button or a combination of them.
Examples
Example Ron config file:
(
axes: {
"updown": Emulated(
pos: Key(Up),
neg: Key(Down)
),
"leftright": Emulated(
pos: Key(Right),
neg: Key(Left)
)
},
actions: {
"fire": [ [Mouse(Left)], [Key(X)] ], // Multiple bindings for one action
"reload": [ [Key(LControl), Key(R)] ] // Combinations of multiple bindings possible
}
)
Methods
impl<T: BindingTypes> Bindings<T>
[src]
impl<T: BindingTypes> Bindings<T>
[src]
pub fn insert_axis<A: Into<T::Axis>>(
&mut self,
id: A,
axis: Axis
) -> Result<Option<Axis>, BindingError<T>>
[src]
&mut self,
id: A,
axis: Axis
) -> Result<Option<Axis>, BindingError<T>>
Assign an axis to an ID value
This will insert a new axis if no entry for this id exists. If one does exist this will replace the axis at that id and return it.
pub fn remove_axis<A: ?Sized>(&mut self, id: &A) -> Option<Axis> where
T::Axis: Borrow<A>,
A: Hash + Eq,
[src]
T::Axis: Borrow<A>,
A: Hash + Eq,
Removes an axis, this will return the removed axis if successful.
pub fn axis<A: ?Sized>(&self, id: &A) -> Option<&Axis> where
T::Axis: Borrow<A>,
A: Hash + Eq,
[src]
T::Axis: Borrow<A>,
A: Hash + Eq,
Returns a reference to an axis.
pub fn axes(&self) -> impl Iterator<Item = &T::Axis>
[src]
Gets a list of all axes
pub fn insert_action_binding<B: IntoIterator<Item = Button>>(
&mut self,
id: T::Action,
binding: B
) -> Result<(), BindingError<T>>
[src]
&mut self,
id: T::Action,
binding: B
) -> Result<(), BindingError<T>>
Add a button or button combination to an action.
This will attempt to insert a new binding between this action and the button(s).
pub fn remove_action_binding<A: ?Sized>(
&mut self,
id: &A,
binding: &[Button]
) -> Result<(), ActionRemovedError> where
T::Action: Borrow<A>,
A: Hash + Eq,
[src]
&mut self,
id: &A,
binding: &[Button]
) -> Result<(), ActionRemovedError> where
T::Action: Borrow<A>,
A: Hash + Eq,
Removes an action binding that was assigned previously.
pub fn action_bindings<A: ?Sized>(
&self,
id: &A
) -> impl Iterator<Item = &[Button]> where
T::Action: Borrow<A>,
A: Hash + Eq,
[src]
&self,
id: &A
) -> impl Iterator<Item = &[Button]> where
T::Action: Borrow<A>,
A: Hash + Eq,
Returns an action's bindings.
pub fn actions(&self) -> impl Iterator<Item = &T::Action>
[src]
Gets a list of all action bindings
pub fn check_invariants(&mut self) -> Result<(), BindingError<T>>
[src]
Check that this structure upholds its guarantees. Should only be necessary when serializing or deserializing the bindings.
Trait Implementations
impl<T: BindingTypes> Default for Bindings<T>
[src]
impl<T: BindingTypes> Clone for Bindings<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: BindingTypes> Debug for Bindings<T>
[src]
impl<'de, T: BindingTypes> Deserialize<'de> for Bindings<T> where
T::Axis: Deserialize<'de>,
T::Action: Deserialize<'de>,
[src]
T::Axis: Deserialize<'de>,
T::Action: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: BindingTypes> Serialize for Bindings<T> where
T::Axis: Serialize,
T::Action: Serialize,
[src]
T::Axis: Serialize,
T::Action: Serialize,
Auto Trait Implementations
impl<T> Unpin for Bindings<T> where
<T as BindingTypes>::Action: Unpin,
<T as BindingTypes>::Axis: Unpin,
<T as BindingTypes>::Action: Unpin,
<T as BindingTypes>::Axis: Unpin,
impl<T> Sync for Bindings<T> where
<T as BindingTypes>::Action: Sync,
<T as BindingTypes>::Axis: Sync,
<T as BindingTypes>::Action: Sync,
<T as BindingTypes>::Axis: Sync,
impl<T> Send for Bindings<T> where
<T as BindingTypes>::Action: Send,
<T as BindingTypes>::Axis: Send,
<T as BindingTypes>::Action: Send,
<T as BindingTypes>::Axis: Send,
impl<T> UnwindSafe for Bindings<T> where
<T as BindingTypes>::Action: UnwindSafe,
<T as BindingTypes>::Axis: UnwindSafe,
<T as BindingTypes>::Action: UnwindSafe,
<T as BindingTypes>::Axis: UnwindSafe,
impl<T> RefUnwindSafe for Bindings<T> where
<T as BindingTypes>::Action: RefUnwindSafe,
<T as BindingTypes>::Axis: RefUnwindSafe,
<T as BindingTypes>::Action: RefUnwindSafe,
<T as BindingTypes>::Axis: RefUnwindSafe,
Blanket Implementations
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
[src]
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Config for T where
T: Deserialize<'a> + Serialize + Default,
[src]
T: Deserialize<'a> + Serialize + Default,
fn load<P>(path: P) -> T where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
fn load_no_fallback<P>(path: P) -> Result<T, ConfigError> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
fn load_bytes(bytes: &[u8]) -> Result<T, ConfigError>
[src]
fn write<P>(&self, path: P) -> Result<(), ConfigError> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn is_in_subset(&self) -> bool
[src]
unsafe fn to_subset_unchecked(&self) -> SS
[src]
fn from_subset(element: &SS) -> SP
[src]
impl<T> Resource for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> Any for T where
T: Any,
[src]
T: Any,
fn get_type_id(&self) -> TypeId
[src]
impl<T> TryDefault for T where
T: Default,
[src]
T: Default,
fn try_default() -> Result<T, String>
[src]
fn unwrap_default() -> Self
[src]
Calls try_default
and panics on an error case.
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,