Struct bevy_internal::input::prelude::Axis
source · pub struct Axis<T> { /* private fields */ }
Expand description
Stores the position data of the input devices of type T
.
The values are stored as f32
s, using Axis::set
.
Use Axis::get
to retrieve the value clamped between Axis::MIN
and Axis::MAX
inclusive, or unclamped using Axis::get_unclamped
.
Implementations§
source§impl<T> Axis<T>
impl<T> Axis<T>
sourcepub fn set(&mut self, input_device: T, position_data: f32) -> Option<f32>
pub fn set(&mut self, input_device: T, position_data: f32) -> Option<f32>
Sets the position data of the input_device
to position_data
.
If the input_device
:
- was present before, the position data is updated, and the old value is returned.
- wasn’t present before,
None
is returned.
sourcepub fn get_unclamped(&self, input_device: T) -> Option<f32>
pub fn get_unclamped(&self, input_device: T) -> Option<f32>
Returns the unclamped position data of the provided input_device
.
This value may be outside of the Axis::MIN
and Axis::MAX
range.
Use for things like camera zoom, where you want devices like mouse wheels to be able to
exceed the normal range. If being able to move faster on one input device
than another would give an unfair advantage, you should likely use Axis::get
instead.
sourcepub fn remove(&mut self, input_device: T) -> Option<f32>
pub fn remove(&mut self, input_device: T) -> Option<f32>
Removes the position data of the input_device
, returning the position data if the input device was previously set.
sourcepub fn devices(&self) -> impl ExactSizeIterator
pub fn devices(&self) -> impl ExactSizeIterator
Returns an iterator of all the input devices that have position data
Trait Implementations§
impl<T> Resource for Axis<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Axis<T>where
T: RefUnwindSafe,
impl<T> Send for Axis<T>where
T: Send,
impl<T> Sync for Axis<T>where
T: Sync,
impl<T> Unpin for Axis<T>where
T: Unpin,
impl<T> UnwindSafe for Axis<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§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
.source§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
.source§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.source§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.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.