Struct leafwing_input_manager::axislike::VirtualAxis
source · pub struct VirtualAxis {
pub negative: InputKind,
pub positive: InputKind,
}Expand description
A virtual Axis that you can get a value between -1 and 1 from.
Typically, you don’t want to store a SingleAxis in this type,
even though it can be stored as an InputKind.
Instead, use it directly as InputKind::SingleAxis!
Fields§
§negative: InputKindThe input that represents the negative direction of this virtual axis
positive: InputKindThe input that represents the positive direction of this virtual axis
Implementations§
source§impl VirtualAxis
impl VirtualAxis
sourcepub const fn from_keys(negative: KeyCode, positive: KeyCode) -> VirtualAxis
pub const fn from_keys(negative: KeyCode, positive: KeyCode) -> VirtualAxis
Helper function for generating a VirtualAxis from arbitrary keycodes, shorthand for
wrapping each key in InputKind::PhysicalKey
sourcepub const fn horizontal_arrow_keys() -> VirtualAxis
pub const fn horizontal_arrow_keys() -> VirtualAxis
Generates a VirtualAxis corresponding to the horizontal arrow keyboard keycodes
sourcepub const fn vertical_arrow_keys() -> VirtualAxis
pub const fn vertical_arrow_keys() -> VirtualAxis
Generates a VirtualAxis corresponding to the horizontal arrow keyboard keycodes
sourcepub const fn ad() -> VirtualAxis
pub const fn ad() -> VirtualAxis
Generates a VirtualAxis corresponding to the AD keyboard keycodes.
sourcepub const fn ws() -> VirtualAxis
pub const fn ws() -> VirtualAxis
Generates a VirtualAxis corresponding to the WS keyboard keycodes.
sourcepub const fn horizontal_dpad() -> VirtualAxis
pub const fn horizontal_dpad() -> VirtualAxis
Generates a VirtualAxis corresponding to the horizontal DPad buttons on a gamepad.
sourcepub const fn vertical_dpad() -> VirtualAxis
pub const fn vertical_dpad() -> VirtualAxis
Generates a VirtualAxis corresponding to the vertical DPad buttons on a gamepad.
Generates a VirtualAxis corresponding to the horizontal gamepad face buttons.
Generates a VirtualAxis corresponding to the vertical gamepad face buttons.
sourcepub fn inverted(self) -> Self
pub fn inverted(self) -> Self
Returns this VirtualAxis but with flipped positive/negative inputs.
Trait Implementations§
source§impl Clone for VirtualAxis
impl Clone for VirtualAxis
source§fn clone(&self) -> VirtualAxis
fn clone(&self) -> VirtualAxis
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for VirtualAxis
impl Debug for VirtualAxis
source§impl<'de> Deserialize<'de> for VirtualAxis
impl<'de> Deserialize<'de> for VirtualAxis
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<VirtualAxis> for UserInput
impl From<VirtualAxis> for UserInput
source§fn from(input: VirtualAxis) -> Self
fn from(input: VirtualAxis) -> Self
source§impl FromReflect for VirtualAxis
impl FromReflect for VirtualAxis
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 VirtualAxis
impl GetTypeRegistration for VirtualAxis
fn get_type_registration() -> TypeRegistration
source§impl Hash for VirtualAxis
impl Hash for VirtualAxis
source§impl PartialEq for VirtualAxis
impl PartialEq for VirtualAxis
source§fn eq(&self, other: &VirtualAxis) -> bool
fn eq(&self, other: &VirtualAxis) -> bool
self and other values to be equal, and is used
by ==.source§impl Reflect for VirtualAxis
impl Reflect for VirtualAxis
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 VirtualAxis
impl Serialize for VirtualAxis
source§impl Struct for VirtualAxis
impl Struct for VirtualAxis
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 VirtualAxis
impl TypePath for VirtualAxis
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 VirtualAxis
impl Typed for VirtualAxis
impl Eq for VirtualAxis
impl StructuralPartialEq for VirtualAxis
Auto Trait Implementations§
impl RefUnwindSafe for VirtualAxis
impl Send for VirtualAxis
impl Sync for VirtualAxis
impl Unpin for VirtualAxis
impl UnwindSafe for VirtualAxis
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