Struct leafwing_input_manager::axislike::SingleAxis
source · pub struct SingleAxis {
pub axis_type: AxisType,
pub positive_low: f32,
pub negative_low: f32,
pub inverted: bool,
pub sensitivity: f32,
pub value: Option<f32>,
}Expand description
Fields§
§axis_type: AxisTypeThe axis that is being checked.
positive_low: f32Any axis value higher than this will trigger the input.
negative_low: f32Any axis value lower than this will trigger the input.
inverted: boolWhether to invert output values from this axis.
sensitivity: f32How sensitive the axis is to input values.
Since sensitivity is a multiplier, any value >1.0 will increase sensitivity while any value <1.0 will decrease sensitivity.
This value should always be strictly positive: a value of 0 will cause the axis to stop functioning,
while negative values will invert the direction.
value: Option<f32>The target value for this input, used for input mocking.
Implementations§
source§impl SingleAxis
impl SingleAxis
sourcepub const fn with_threshold(
axis_type: AxisType,
negative_low: f32,
positive_low: f32
) -> SingleAxis
pub const fn with_threshold( axis_type: AxisType, negative_low: f32, positive_low: f32 ) -> SingleAxis
Creates a SingleAxis with the given positive_low and negative_low thresholds.
sourcepub fn symmetric(axis_type: impl Into<AxisType>, threshold: f32) -> SingleAxis
pub fn symmetric(axis_type: impl Into<AxisType>, threshold: f32) -> SingleAxis
Creates a SingleAxis with both positive_low and negative_low set to threshold.
sourcepub fn from_value(axis_type: impl Into<AxisType>, value: f32) -> SingleAxis
pub fn from_value(axis_type: impl Into<AxisType>, value: f32) -> SingleAxis
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 mouse_wheel_x() -> SingleAxis
pub const fn mouse_wheel_x() -> SingleAxis
Creates a SingleAxis corresponding to horizontal MouseWheel movement
sourcepub const fn mouse_wheel_y() -> SingleAxis
pub const fn mouse_wheel_y() -> SingleAxis
Creates a SingleAxis corresponding to vertical MouseWheel movement
sourcepub const fn mouse_motion_x() -> SingleAxis
pub const fn mouse_motion_x() -> SingleAxis
Creates a SingleAxis corresponding to horizontal MouseMotion movement
sourcepub const fn mouse_motion_y() -> SingleAxis
pub const fn mouse_motion_y() -> SingleAxis
Creates a SingleAxis corresponding to vertical MouseMotion movement
sourcepub fn negative_only(
axis_type: impl Into<AxisType>,
threshold: f32
) -> SingleAxis
pub fn negative_only( axis_type: impl Into<AxisType>, threshold: f32 ) -> SingleAxis
Creates a SingleAxis with the axis_type and negative_low set to threshold.
Positive values will not trigger the input.
sourcepub fn positive_only(
axis_type: impl Into<AxisType>,
threshold: f32
) -> SingleAxis
pub fn positive_only( axis_type: impl Into<AxisType>, threshold: f32 ) -> SingleAxis
Creates a SingleAxis with the axis_type and positive_low set to threshold.
Negative values will not trigger the input.
sourcepub fn with_deadzone(self, deadzone: f32) -> SingleAxis
pub fn with_deadzone(self, deadzone: f32) -> SingleAxis
Returns this SingleAxis with the deadzone set to the specified value
sourcepub fn with_sensitivity(self, sensitivity: f32) -> SingleAxis
pub fn with_sensitivity(self, sensitivity: f32) -> SingleAxis
Returns this SingleAxis with the sensitivity set to the specified value
sourcepub fn inverted(self) -> Self
pub fn inverted(self) -> Self
Returns this SingleAxis inverted.
Trait Implementations§
source§impl Clone for SingleAxis
impl Clone for SingleAxis
source§fn clone(&self) -> SingleAxis
fn clone(&self) -> SingleAxis
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for SingleAxis
impl Debug for SingleAxis
source§impl<'de> Deserialize<'de> for SingleAxis
impl<'de> Deserialize<'de> for SingleAxis
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 From<SingleAxis> for InputKind
impl From<SingleAxis> for InputKind
source§fn from(input: SingleAxis) -> Self
fn from(input: SingleAxis) -> Self
source§impl From<SingleAxis> for UserInput
impl From<SingleAxis> for UserInput
source§fn from(input: SingleAxis) -> Self
fn from(input: SingleAxis) -> Self
source§impl FromReflect for SingleAxis
impl FromReflect for SingleAxis
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 SingleAxis
impl GetTypeRegistration for SingleAxis
fn get_type_registration() -> TypeRegistration
source§impl Hash for SingleAxis
impl Hash for SingleAxis
source§impl PartialEq for SingleAxis
impl PartialEq for SingleAxis
source§impl Reflect for SingleAxis
impl Reflect for SingleAxis
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 Serialize for SingleAxis
impl Serialize for SingleAxis
source§impl Struct for SingleAxis
impl Struct for SingleAxis
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 SingleAxis
impl TypePath for SingleAxis
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 SingleAxis
impl Typed for SingleAxis
impl Copy for SingleAxis
impl Eq for SingleAxis
Auto Trait Implementations§
impl RefUnwindSafe for SingleAxis
impl Send for SingleAxis
impl Sync for SingleAxis
impl Unpin for SingleAxis
impl UnwindSafe for SingleAxis
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