pub struct DigitalAxis2d<A: Action> { /* private fields */ }Expand description
Four logical actions sampled as a digital two-dimensional axis.
The descriptor contains no input state and is independent from physical key bindings. Reusing one action in several slots is allowed: each slot is sampled independently and opposite slots cancel through subtraction.
Implementations§
Source§impl<A: Action> DigitalAxis2d<A>
impl<A: Action> DigitalAxis2d<A>
Sourcepub const fn new(
negative_x: A,
positive_x: A,
negative_y: A,
positive_y: A,
) -> Self
pub const fn new( negative_x: A, positive_x: A, negative_y: A, positive_y: A, ) -> Self
Creates a descriptor in negative-x, positive-x, negative-y, positive-y order.
For conventional world movement this normally receives left, right, down, and up actions. The mapping is infallible and may contain the same action more than once.
Sourcepub const fn negative_x(self) -> A
pub const fn negative_x(self) -> A
Returns the action contributing -1.0 to the x component while held.
Sourcepub const fn positive_x(self) -> A
pub const fn positive_x(self) -> A
Returns the action contributing 1.0 to the x component while held.
Sourcepub const fn negative_y(self) -> A
pub const fn negative_y(self) -> A
Returns the action contributing -1.0 to the y component while held.
Sourcepub const fn positive_y(self) -> A
pub const fn positive_y(self) -> A
Returns the action contributing 1.0 to the y component while held.
Trait Implementations§
impl<A: Copy + Action> Copy for DigitalAxis2d<A>
impl<A: Eq + Action> Eq for DigitalAxis2d<A>
impl<A: PartialEq + Action> StructuralPartialEq for DigitalAxis2d<A>
Auto Trait Implementations§
impl<A> Freeze for DigitalAxis2d<A>where
A: Freeze,
impl<A> RefUnwindSafe for DigitalAxis2d<A>where
A: RefUnwindSafe,
impl<A> Send for DigitalAxis2d<A>
impl<A> Sync for DigitalAxis2d<A>
impl<A> Unpin for DigitalAxis2d<A>where
A: Unpin,
impl<A> UnsafeUnpin for DigitalAxis2d<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for DigitalAxis2d<A>where
A: UnwindSafe,
Blanket Implementations§
impl<T> Action for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.