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: SingleAxis
The axis representing horizontal movement.
y: SingleAxis
The axis representing vertical movement.
deadzone: DeadZoneShape
The 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 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 fn left_stick() -> DualAxis
pub fn left_stick() -> DualAxis
Creates a DualAxis
for the left analogue stick of the gamepad.
sourcepub fn right_stick() -> DualAxis
pub 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 PartialEq for DualAxis
impl PartialEq for DualAxis
impl Copy for DualAxis
impl Eq for DualAxis
impl StructuralEq 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> CallHasher for T
impl<T> CallHasher for 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<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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.