#[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)
Trait Implementations§
Source§impl BitFlags for EngineInput
impl BitFlags for EngineInput
type Other = u32
Source§fn contains(self, other: Self::Other) -> bool
fn contains(self, other: Self::Other) -> bool
returns true if
other is entirely represented in selfSource§fn contained_by(self, other: Self::Other) -> bool
fn contained_by(self, other: Self::Other) -> bool
returns true if
self is entirely represented in otherSource§fn intersects(self, other: Self::Other) -> bool
fn intersects(self, other: Self::Other) -> bool
Returns true if
self and other share any bitsSource§fn count_ones(self) -> u32
fn count_ones(self) -> u32
Returns the total number of
1 bitsSource§fn count_zeroes(self) -> u32
fn count_zeroes(self) -> u32
Returns the total number of
0 bitsSource§impl BitOr for EngineInput
impl BitOr for EngineInput
Source§impl Clone for EngineInput
impl Clone for EngineInput
Source§fn clone(&self) -> EngineInput
fn clone(&self) -> EngineInput
Returns a duplicate 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 EngineInput
impl Debug for EngineInput
Source§impl Deref for EngineInput
impl Deref for EngineInput
Source§impl Display for EngineInput
impl Display for EngineInput
Source§impl From<EngineInput> for u32
impl From<EngineInput> for u32
Source§fn from(val: EngineInput) -> u32
fn from(val: EngineInput) -> u32
Converts to this type from the input type.
Source§impl From<u32> for EngineInput
impl From<u32> for EngineInput
Source§impl Hash for EngineInput
impl Hash for EngineInput
Source§impl PartialEq for EngineInput
impl PartialEq for EngineInput
impl Buttons for EngineInput
impl Copy for EngineInput
impl Eq for EngineInput
impl StructuralPartialEq for EngineInput
Auto Trait Implementations§
impl Freeze for EngineInput
impl RefUnwindSafe for EngineInput
impl Send for EngineInput
impl Sync for EngineInput
impl Unpin for EngineInput
impl UnwindSafe for EngineInput
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