pub trait DualAxislike:
UserInput
+ DynClone
+ DynEq
+ DynHash
+ Reflect
+ Serialize {
// Required method
fn axis_pair(
&self,
input_store: &CentralInputStore,
gamepad: Entity,
) -> 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<Entity>,
) { ... }
}
Expand description
A trait used for dual-axis-like user inputs, which provide separate X and Y values.
Required Methods§
Sourcefn axis_pair(&self, input_store: &CentralInputStore, gamepad: Entity) -> Vec2
fn axis_pair(&self, input_store: &CentralInputStore, gamepad: Entity) -> Vec2
Gets the values of this input along the X and Y axes (if applicable).
Provided Methods§
Sourcefn set_axis_pair(&self, world: &mut World, value: Vec2)
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.
Sourcefn set_axis_pair_as_gamepad(
&self,
world: &mut World,
value: Vec2,
_gamepad: Option<Entity>,
)
fn set_axis_pair_as_gamepad( &self, world: &mut World, value: Vec2, _gamepad: Option<Entity>, )
Simulate a dual-axis-like input, pretending to be the provided gamepad Entity
.
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>
impl<'de> Deserialize<'de> for Box<dyn DualAxislike>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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>
impl FromReflect for Box<dyn DualAxislike>
Source§fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self>
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self>
Constructs a concrete instance of
Self
from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Attempts to downcast the given value to
Self
using,
constructing the value using from_reflect
if that fails. Read moreSource§impl GetTypeRegistration for Box<dyn DualAxislike>
impl GetTypeRegistration for Box<dyn DualAxislike>
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
Returns the default
TypeRegistration
for this type.Source§fn register_type_dependencies(_registry: &mut TypeRegistry)
fn register_type_dependencies(_registry: &mut TypeRegistry)
Registers other types needed by this type. Read more
Source§impl<'hash> Hash for dyn DualAxislike + 'hash
impl<'hash> Hash for dyn DualAxislike + 'hash
Source§impl<'hash> Hash for dyn DualAxislike + Send + 'hash
impl<'hash> Hash for dyn DualAxislike + Send + 'hash
Source§impl<'hash> Hash for dyn DualAxislike + Sync + 'hash
impl<'hash> Hash for dyn DualAxislike + Sync + 'hash
Source§impl<'eq> PartialEq<&Box<dyn DualAxislike + 'eq>> for Box<dyn DualAxislike + 'eq>
impl<'eq> PartialEq<&Box<dyn DualAxislike + 'eq>> for Box<dyn DualAxislike + 'eq>
Source§impl<'eq> PartialEq<&Box<dyn DualAxislike + Send + 'eq>> for Box<dyn DualAxislike + Send + 'eq>
impl<'eq> PartialEq<&Box<dyn DualAxislike + Send + 'eq>> for Box<dyn DualAxislike + Send + 'eq>
Source§impl<'eq> PartialEq<&Box<dyn DualAxislike + Sync + Send + 'eq>> for Box<dyn DualAxislike + Send + Sync + 'eq>
impl<'eq> PartialEq<&Box<dyn DualAxislike + Sync + Send + 'eq>> for Box<dyn DualAxislike + Send + Sync + 'eq>
Source§impl<'eq> PartialEq<&Box<dyn DualAxislike + Sync + 'eq>> for Box<dyn DualAxislike + Sync + 'eq>
impl<'eq> PartialEq<&Box<dyn DualAxislike + Sync + 'eq>> for Box<dyn DualAxislike + Sync + 'eq>
Source§impl<'eq> PartialEq for dyn DualAxislike + 'eq
impl<'eq> PartialEq for dyn DualAxislike + 'eq
Source§impl<'eq> PartialEq for dyn DualAxislike + Send + 'eq
impl<'eq> PartialEq for dyn DualAxislike + Send + 'eq
Source§impl<'eq> PartialEq for dyn DualAxislike + Sync + 'eq
impl<'eq> PartialEq for dyn DualAxislike + Sync + 'eq
Source§impl PartialReflect for Box<dyn DualAxislike>
impl PartialReflect for Box<dyn DualAxislike>
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError>
fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Returns a zero-sized enumeration of “kinds” of type. Read more
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Returns an immutable enumeration of “kinds” of type. Read more
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Returns a mutable enumeration of “kinds” of type. Read more
Source§fn reflect_owned(self: Box<Self>) -> ReflectOwned
fn reflect_owned(self: Box<Self>) -> ReflectOwned
Returns an owned enumeration of “kinds” of type. Read more
Source§fn clone_value(&self) -> Box<dyn PartialReflect>
fn clone_value(&self) -> Box<dyn PartialReflect>
👎Deprecated since 0.16.0: to clone reflected values, prefer using
reflect_clone
. To convert reflected values to dynamic ones, use to_dynamic
.Clones
Self
into its dynamic representation. Read moreSource§fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect>
Casts this type to a boxed, reflected value. Read more
Source§fn as_partial_reflect(&self) -> &dyn PartialReflect
fn as_partial_reflect(&self) -> &dyn PartialReflect
Casts this type to a reflected value. Read more
Source§fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect
Casts this type to a mutable, reflected value. Read more
Source§fn try_into_reflect(
self: Box<Self>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<Self>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Attempts to cast this type to a boxed, fully-reflected value.
Source§fn try_as_reflect(&self) -> Option<&dyn Reflect>
fn try_as_reflect(&self) -> Option<&dyn Reflect>
Attempts to cast this type to a fully-reflected value.
Source§fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>
Attempts to cast this type to a mutable, fully-reflected value.
Source§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Applies a reflected value to this value. Read more
Source§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Attempts to clone
Self
using reflection. Read moreSource§fn reflect_hash(&self) -> Option<u64>
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 PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, _value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Returns a “partial equality” comparison result. Read more
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Debug formatter for the value. Read more
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Indicates whether or not this type is a dynamic type. Read more
Source§impl Reflect for Box<dyn DualAxislike>
impl Reflect for Box<dyn DualAxislike>
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Returns the value as a
&mut dyn Any
. Read moreSource§fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>
Casts this type to a boxed, fully-reflected value.
Source§fn as_reflect(&self) -> &dyn Reflect
fn as_reflect(&self) -> &dyn Reflect
Casts this type to a fully-reflected value.
Source§fn as_reflect_mut(&mut self) -> &mut dyn Reflect
fn as_reflect_mut(&mut self) -> &mut dyn Reflect
Casts this type to a mutable, fully-reflected value.
Source§impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for DualAxislikeChord
impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for DualAxislikeChord
Source§fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)
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
impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for GamepadStick
Source§fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)
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
impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for MouseMove
Source§fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)
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
impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for MouseScroll
Source§fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)
fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)
Registers the specified type tag into the
InfallibleMapRegistry
.Source§impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for VirtualDPad
impl<'de> RegisterTypeTag<'de, dyn DualAxislike> for VirtualDPad
Source§fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)
fn register_typetag(registry: &mut InfallibleMapRegistry<dyn DualAxislike>)
Registers the specified type tag into the
InfallibleMapRegistry
.Source§impl Serialize for dyn DualAxislike + '_
impl Serialize for dyn DualAxislike + '_
Source§impl TypePath for Box<dyn DualAxislike>
impl TypePath for Box<dyn DualAxislike>
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Returns the fully qualified path of the underlying type. Read more
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Returns a short, pretty-print enabled path to the type. Read more