leafwing_input_manager::user_input

Trait DualAxislike

source
pub trait DualAxislike:
    UserInput
    + DynClone
    + DynEq
    + DynHash
    + Reflect
    + Serialize {
    // Required method
    fn axis_pair(
        &self,
        input_store: &CentralInputStore,
        gamepad: Gamepad,
    ) -> Vec2;

    // Provided methods
    fn set_axis_pair(&self, world: &mut World, value: Vec2) { ... }
    fn set_axis_pair_as_gamepad(
        &self,
        world: &mut World,
        value: Vec2,
        _gamepad: Option<Gamepad>,
    ) { ... }
}
Expand description

A trait used for dual-axis-like user inputs, which provide separate X and Y values.

Required Methods§

source

fn axis_pair(&self, input_store: &CentralInputStore, gamepad: Gamepad) -> Vec2

Gets the values of this input along the X and Y axes (if applicable).

Provided Methods§

source

fn set_axis_pair(&self, world: &mut World, value: Vec2)

Simulate a dual-axis-like input by sending the appropriate event.

This method defaults to calling DualAxislike::set_axis_pair_as_gamepad if not overridden, as is the case for gamepad-reliant inputs.

source

fn set_axis_pair_as_gamepad( &self, world: &mut World, value: Vec2, _gamepad: Option<Gamepad>, )

Simulate a dual-axis-like input, pretending to be the provided Gamepad.

This method defaults to calling DualAxislike::set_axis_pair if not overridden, as is the case for things like a mouse wheel.

Use find_gamepad inside of this method to search for a gamepad to press the button on if the provided gamepad is None.

Trait Implementations§

source§

impl<'de> Deserialize<'de> for Box<dyn DualAxislike>

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl FromReflect for Box<dyn DualAxislike>

source§

fn from_reflect(reflect: &dyn Reflect) -> Option<Self>

Constructs a concrete instance of Self from a reflected value.
source§

fn take_from_reflect( reflect: Box<dyn Reflect>, ) -> Result<Self, Box<dyn Reflect>>

Attempts to downcast the given value to Self using, constructing the value using from_reflect if that fails. Read more
source§

impl GetTypeRegistration for Box<dyn DualAxislike>

source§

fn get_type_registration() -> TypeRegistration

Returns the default TypeRegistration for this type.
source§

fn register_type_dependencies(registry: &mut TypeRegistry)

Registers other types needed by this type. Read more
source§

impl<'hash> Hash for dyn DualAxislike + 'hash

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<'hash> Hash for dyn DualAxislike + Send + 'hash

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<'hash> Hash for dyn DualAxislike + Send + Sync + 'hash

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<'hash> Hash for dyn DualAxislike + Sync + 'hash

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<'eq> PartialEq<&Box<dyn DualAxislike + 'eq>> for Box<dyn DualAxislike + 'eq>

source§

fn eq(&self, other: &&Self) -> 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<'eq> PartialEq<&Box<dyn DualAxislike + Send + 'eq>> for Box<dyn DualAxislike + Send + 'eq>

source§

fn eq(&self, other: &&Self) -> 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<'eq> PartialEq<&Box<dyn DualAxislike + Send + Sync + 'eq>> for Box<dyn DualAxislike + Send + Sync + 'eq>

source§

fn eq(&self, other: &&Self) -> 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<'eq> PartialEq<&Box<dyn DualAxislike + Sync + 'eq>> for Box<dyn DualAxislike + Sync + 'eq>

source§

fn eq(&self, other: &&Self) -> 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<'eq> PartialEq for dyn DualAxislike + 'eq

source§

fn eq(&self, other: &Self) -> 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<'eq> PartialEq for dyn DualAxislike + Send + 'eq

source§

fn eq(&self, other: &Self) -> 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<'eq> PartialEq for dyn DualAxislike + Send + Sync + 'eq

source§

fn eq(&self, other: &Self) -> 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<'eq> PartialEq for dyn DualAxislike + Sync + 'eq

source§

fn eq(&self, other: &Self) -> 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 Reflect for Box<dyn DualAxislike>

source§

fn get_represented_type_info(&self) -> Option<&'static TypeInfo>

Returns the TypeInfo of the type represented by this value. Read more
source§

fn into_any(self: Box<Self>) -> Box<dyn Any>

Returns the value as a Box<dyn Any>.
source§

fn as_any(&self) -> &dyn Any

Returns the value as a &dyn Any.
source§

fn as_any_mut(&mut self) -> &mut dyn Any

Returns the value as a &mut dyn Any.
source§

fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>

Casts this type to a boxed reflected value.
source§

fn as_reflect(&self) -> &dyn Reflect

Casts this type to a reflected value.
source§

fn as_reflect_mut(&mut self) -> &mut dyn Reflect

Casts this type to a mutable reflected value.
source§

fn try_apply(&mut self, value: &dyn Reflect) -> Result<(), ApplyError>

Tries to apply a reflected value to this value. Read more
source§

fn apply(&mut self, value: &dyn Reflect)

Applies a reflected value to this value. Read more
source§

fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>

Performs a type-checked assignment of a reflected value to this value. Read more
source§

fn reflect_kind(&self) -> ReflectKind

Returns a zero-sized enumeration of “kinds” of type. Read more
source§

fn reflect_ref(&self) -> ReflectRef<'_>

Returns an immutable enumeration of “kinds” of type. Read more
source§

fn reflect_mut(&mut self) -> ReflectMut<'_>

Returns a mutable enumeration of “kinds” of type. Read more
source§

fn reflect_owned(self: Box<Self>) -> ReflectOwned

Returns an owned enumeration of “kinds” of type. Read more
source§

fn clone_value(&self) -> Box<dyn Reflect>

Clones the value as a Reflect trait object. Read more
source§

fn reflect_hash(&self) -> Option<u64>

Returns a hash of the value (which includes the type). Read more
source§

fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>

Returns a “partial equality” comparison result. Read more
source§

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

Debug formatter for the value. Read more
source§

fn serializable(&self) -> Option<Serializable<'_>>

Returns a serializable version of the value. Read more
source§

fn is_dynamic(&self) -> bool

Indicates whether or not this type is a dynamic type. Read more
source§

impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for DualAxislikeChord

source§

fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)

Registers the specified type tag into the InfallibleMapRegistry.
source§

impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for GamepadStick

source§

fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)

Registers the specified type tag into the InfallibleMapRegistry.
source§

impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for GamepadVirtualDPad

source§

fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)

Registers the specified type tag into the InfallibleMapRegistry.
source§

impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for KeyboardVirtualDPad

source§

fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)

Registers the specified type tag into the InfallibleMapRegistry.
source§

impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for MouseMove

source§

fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)

Registers the specified type tag into the InfallibleMapRegistry.
source§

impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for MouseScroll

source§

fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)

Registers the specified type tag into the InfallibleMapRegistry.
source§

impl<'a> Serialize for dyn DualAxislike + 'a

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TypePath for Box<dyn DualAxislike>

source§

fn type_path() -> &'static str

Returns the fully qualified path of the underlying type. Read more
source§

fn short_type_path() -> &'static str

Returns a short, pretty-print enabled path to the type. Read more
source§

fn type_ident() -> Option<&'static str>

Returns the name of the type, or None if it is anonymous. Read more
source§

fn crate_name() -> Option<&'static str>

Returns the name of the crate the type is in, or None if it is anonymous. Read more
source§

fn module_path() -> Option<&'static str>

Returns the path to the module the type is in, or None if it is anonymous. Read more
source§

impl Typed for Box<dyn DualAxislike>

source§

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.
source§

impl<'eq> Eq for dyn DualAxislike + 'eq

source§

impl<'eq> Eq for dyn DualAxislike + Send + 'eq

source§

impl<'eq> Eq for dyn DualAxislike + Send + Sync + 'eq

source§

impl<'eq> Eq for dyn DualAxislike + Sync + 'eq

Implementors§