#[repr(u16)]pub enum Axis {
LeftStickX,
LeftStickY,
LeftZ,
RightStickX,
RightStickY,
RightZ,
DPadX,
DPadY,
Unknown,
}
Expand description
An analog axis of some device (gamepad thumbstick, joystick…). Gamepad’s elements which state can be represented by value from -1.0 to 1.0.
Variants§
Implementations§
source§impl Axis
impl Axis
sourcepub fn is_stick(self) -> bool
pub fn is_stick(self) -> bool
Returns true if axis is LeftStickX
, LeftStickY
, RightStickX
or RightStickY
.
sourcepub fn second_axis(self) -> Option<Axis>
pub fn second_axis(self) -> Option<Axis>
Returns the other axis from same element of gamepad, if any.
input | output |
---|---|
LeftStickX | Some(LeftStickY) |
LeftStickY | Some(LeftStickX) |
RightStickX | Some(RightStickY) |
RightStickY | Some(RightStickX) |
DpadX | Some(DpadY) |
DpadY | Some(DpadX) |
… | None |
Trait Implementations§
source§impl PartialEq<Axis> for Axis
impl PartialEq<Axis> for Axis
impl Copy for Axis
impl Eq for Axis
impl StructuralEq for Axis
impl StructuralPartialEq for Axis
Auto Trait Implementations§
impl RefUnwindSafe for Axis
impl Send for Axis
impl Sync for Axis
impl Unpin for Axis
impl UnwindSafe for Axis
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
source§impl<T> HasMut<T> for T
impl<T> HasMut<T> for T
source§fn retrieve_mut(&mut self) -> &mut T
fn retrieve_mut(&mut self) -> &mut T
Method to retrieve the context type as mutable.