Struct leafwing_input_manager::axislike::DualAxis
source · pub struct DualAxis {
pub x: SingleAxis,
pub y: SingleAxis,
pub deadzone: DeadZoneShape,
}Expand description
Two directional axes combined as one input.
These can be stored in a VirtualDPad, which is itself stored in an InputKind for consumption.
This input will generate a DualAxis which can be read with
ActionState::axis_pair.
§Warning
positive_low must be greater than or equal to negative_low for both x and y for this type to be validly constructed.
Fields§
§x: SingleAxisThe axis representing horizontal movement.
y: SingleAxisThe axis representing vertical movement.
deadzone: DeadZoneShapeThe shape of the deadzone
Implementations§
source§impl DualAxis
impl DualAxis
sourcepub const DEFAULT_DEADZONE: f32 = 0.100000001f32
pub const DEFAULT_DEADZONE: f32 = 0.100000001f32
The default size of the deadzone used by constructor methods.
This cannot be changed, but the struct can be easily manually constructed.
sourcepub const DEFAULT_DEADZONE_SHAPE: DeadZoneShape = _
pub const DEFAULT_DEADZONE_SHAPE: DeadZoneShape = _
The default shape of the deadzone used by constructor methods.
This cannot be changed, but the struct can be easily manually constructed.
sourcepub const ZERO_DEADZONE_SHAPE: DeadZoneShape = _
pub const ZERO_DEADZONE_SHAPE: DeadZoneShape = _
A deadzone with a size of 0.0 used by constructor methods.
This cannot be changed, but the struct can be easily manually constructed.
sourcepub fn symmetric(
x_axis_type: impl Into<AxisType>,
y_axis_type: impl Into<AxisType>,
deadzone_shape: DeadZoneShape
) -> DualAxis
pub fn symmetric( x_axis_type: impl Into<AxisType>, y_axis_type: impl Into<AxisType>, deadzone_shape: DeadZoneShape ) -> DualAxis
Creates a DualAxis with both positive_low and negative_low in both axes set to threshold with a deadzone_shape.
sourcepub fn from_value(
x_axis_type: impl Into<AxisType>,
y_axis_type: impl Into<AxisType>,
x_value: f32,
y_value: f32
) -> DualAxis
pub fn from_value( x_axis_type: impl Into<AxisType>, y_axis_type: impl Into<AxisType>, x_value: f32, y_value: f32 ) -> DualAxis
Creates a SingleAxis with the specified axis_type and value.
All thresholds are set to 0.0. Primarily useful for input mocking.
sourcepub const fn left_stick() -> DualAxis
pub const fn left_stick() -> DualAxis
Creates a DualAxis for the left analogue stick of the gamepad.
sourcepub const fn right_stick() -> DualAxis
pub const fn right_stick() -> DualAxis
Creates a DualAxis for the right analogue stick of the gamepad.
sourcepub const fn mouse_wheel() -> DualAxis
pub const fn mouse_wheel() -> DualAxis
Creates a DualAxis corresponding to horizontal and vertical MouseWheel movement
sourcepub const fn mouse_motion() -> DualAxis
pub const fn mouse_motion() -> DualAxis
Creates a DualAxis corresponding to horizontal and vertical MouseMotion movement
sourcepub fn with_deadzone(self, deadzone: DeadZoneShape) -> DualAxis
pub fn with_deadzone(self, deadzone: DeadZoneShape) -> DualAxis
Returns this DualAxis with the deadzone set to the specified values and shape
sourcepub fn with_sensitivity(
self,
x_sensitivity: f32,
y_sensitivity: f32
) -> DualAxis
pub fn with_sensitivity( self, x_sensitivity: f32, y_sensitivity: f32 ) -> DualAxis
Returns this DualAxis with the sensitivity set to the specified values
sourcepub fn inverted_x(self) -> DualAxis
pub fn inverted_x(self) -> DualAxis
Returns this DualAxis with an inverted X-axis.
sourcepub fn inverted_y(self) -> DualAxis
pub fn inverted_y(self) -> DualAxis
Returns this DualAxis with an inverted Y-axis.
Trait Implementations§
source§impl<'de> Deserialize<'de> for DualAxis
impl<'de> Deserialize<'de> for DualAxis
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>,
source§impl FromReflect for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
impl FromReflect for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
source§fn from_reflect(reflect: &dyn Reflect) -> Option<Self>
fn from_reflect(reflect: &dyn Reflect) -> Option<Self>
Self from a reflected value.§fn take_from_reflect(
reflect: Box<dyn Reflect>
) -> Result<Self, Box<dyn Reflect>>
fn take_from_reflect( reflect: Box<dyn Reflect> ) -> Result<Self, Box<dyn Reflect>>
Self using,
constructing the value using from_reflect if that fails. Read moresource§impl GetTypeRegistration for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
impl GetTypeRegistration for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
fn get_type_registration() -> TypeRegistration
source§impl PartialEq for DualAxis
impl PartialEq for DualAxis
source§impl Reflect for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
impl Reflect for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
TypeInfo] of the type represented by this value. Read moresource§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
&mut dyn Any.source§fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>
source§fn as_reflect(&self) -> &dyn Reflect
fn as_reflect(&self) -> &dyn Reflect
source§fn as_reflect_mut(&mut self) -> &mut dyn Reflect
fn as_reflect_mut(&mut self) -> &mut dyn Reflect
source§fn clone_value(&self) -> Box<dyn Reflect>
fn clone_value(&self) -> Box<dyn Reflect>
Reflect trait object. Read moresource§fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
source§fn reflect_owned(self: Box<Self>) -> ReflectOwned
fn reflect_owned(self: Box<Self>) -> ReflectOwned
source§fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>
fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>
§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
source§impl Struct for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
impl Struct for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
source§fn field(&self, name: &str) -> Option<&dyn Reflect>
fn field(&self, name: &str) -> Option<&dyn Reflect>
name as a &dyn Reflect.source§fn field_mut(&mut self, name: &str) -> Option<&mut dyn Reflect>
fn field_mut(&mut self, name: &str) -> Option<&mut dyn Reflect>
name as a
&mut dyn Reflect.source§fn field_at(&self, index: usize) -> Option<&dyn Reflect>
fn field_at(&self, index: usize) -> Option<&dyn Reflect>
index as a
&dyn Reflect.source§fn field_at_mut(&mut self, index: usize) -> Option<&mut dyn Reflect>
fn field_at_mut(&mut self, index: usize) -> Option<&mut dyn Reflect>
index
as a &mut dyn Reflect.source§fn name_at(&self, index: usize) -> Option<&str>
fn name_at(&self, index: usize) -> Option<&str>
index.source§fn iter_fields(&self) -> FieldIter<'_>
fn iter_fields(&self) -> FieldIter<'_>
source§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
DynamicStruct].source§impl TypePath for DualAxis
impl TypePath for DualAxis
source§fn type_path() -> &'static str
fn type_path() -> &'static str
source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
source§impl Typed for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
impl Typed for DualAxiswhere
Self: Any + Send + Sync,
SingleAxis: FromReflect + TypePath,
DeadZoneShape: FromReflect + TypePath,
impl Copy for DualAxis
impl Eq for DualAxis
impl StructuralPartialEq for DualAxis
Auto Trait Implementations§
impl RefUnwindSafe for DualAxis
impl Send for DualAxis
impl Sync for DualAxis
impl Unpin for DualAxis
impl UnwindSafe for DualAxis
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T [ShaderType] for self. When used in [AsBindGroup]
derives, it is safe to assume that all images in self exist.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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DynEq for T
impl<T> DynEq for T
§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path].§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
TypePath::short_type_path].§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident].§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name].§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
TypePath::module_path].§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
§impl<T> GetPath for Twhere
T: Reflect + ?Sized,
impl<T> GetPath for Twhere
T: Reflect + ?Sized,
§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>
) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p> ) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>
path. Read more§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>
) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p> ) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>
path. Read more