EngineInput

Enum EngineInput 

Source
#[repr(u32)]
pub enum EngineInput {
Show 23 variants None = 0, DPAD_LEFT = 1, DPAD_RIGHT = 2, DPAD_DOWN = 4, DPAD_UP = 8, Z = 16, R = 32, L = 64, A = 256, B = 512, X = 1_024, Y = 2_048, START = 4_096, JOYSTICK_UP = 65_536, JOYSTICK_DOWN = 131_072, JOYSTICK_LEFT = 262_144, JOYSTICK_RIGHT = 524_288, CSTICK_UP = 1_048_576, CSTICK_DOWN = 2_097_152, CSTICK_LEFT = 4_194_304, CSTICK_RIGHT = 8_388_608, ANY_TRIGGER = 2_147_483_648, Raw(u32),
}
Expand description

The buttons as interpreted by the game engine. See buttons::Controller for buttons as seen by the console’s controller polls directly.

Can be casted trivially to and from u32 via deref abuse

let flags = EngineInput::X | EngineInput::A | EngineInput::L;
let val: u32 = *flags;
let back: EngineInput = val.into();
let back_again = EngineInput::from(val);

Notably, the engine considers Z presses to be analog trigger 0.35 + Z + A, while the controller sees Z as just Z.

ANY_TRIGGER is active when either L or R is active, and/or when there is an analog value

= 0.30

Variants§

§

None = 0

§

DPAD_LEFT = 1

§

DPAD_RIGHT = 2

§

DPAD_DOWN = 4

§

DPAD_UP = 8

§

Z = 16

When active, will always also be accompanied by A and ANY_TRIGGER If you’re looking for Z in isolation, use buttons::Controller

§

R = 32

Digital press

§

L = 64

Digital press

§

A = 256

§

B = 512

§

X = 1_024

§

Y = 2_048

§

START = 4_096

§

JOYSTICK_UP = 65_536

§

JOYSTICK_DOWN = 131_072

§

JOYSTICK_LEFT = 262_144

§

JOYSTICK_RIGHT = 524_288

§

CSTICK_UP = 1_048_576

§

CSTICK_DOWN = 2_097_152

§

CSTICK_LEFT = 4_194_304

§

CSTICK_RIGHT = 8_388_608

§

ANY_TRIGGER = 2_147_483_648

active when either L or R is active, and/or when there is an analog value

= 0.30

§

Raw(u32)

Methods from Deref<Target = u32>§

1.43.0 · Source

pub const MIN: u32 = 0u32

1.43.0 · Source

pub const MAX: u32 = 4_294_967_295u32

1.53.0 · Source

pub const BITS: u32 = 32u32

Trait Implementations§

Source§

impl BitFlags for EngineInput

Source§

type Other = u32

Source§

fn contains(self, other: Self::Other) -> bool

returns true if other is entirely represented in self
Source§

fn contained_by(self, other: Self::Other) -> bool

returns true if self is entirely represented in other
Source§

fn intersects(self, other: Self::Other) -> bool

Returns true if self and other share any bits
Source§

fn count_ones(self) -> u32

Returns the total number of 1 bits
Source§

fn count_zeroes(self) -> u32

Returns the total number of 0 bits
Source§

impl BitOr for EngineInput

Source§

type Output = EngineInput

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl Clone for EngineInput

Source§

fn clone(&self) -> EngineInput

Returns a duplicate 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 EngineInput

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Deref for EngineInput

Source§

type Target = u32

The resulting type after dereferencing.
Source§

fn deref(&self) -> &u32

Dereferences the value.
Source§

impl Display for EngineInput

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<EngineInput> for u32

Source§

fn from(val: EngineInput) -> u32

Converts to this type from the input type.
Source§

impl From<u32> for EngineInput

Source§

fn from(val: u32) -> Self

Converts to this type from the input type.
Source§

impl Hash for EngineInput

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EngineInput

Source§

fn eq(&self, other: &EngineInput) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Buttons for EngineInput

Source§

impl Copy for EngineInput

Source§

impl Eq for EngineInput

Source§

impl StructuralPartialEq for EngineInput

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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

Source§

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.