pub struct FixedInput<'w, A: Action> { /* private fields */ }Expand description
Read-only logical input for the current FixedUpdate delivery.
Fixed edges survive frames with no fixed tick and are delivered to every system in the first later tick, without exposing mutable snapshot access. Their total retained count is bounded by the application’s input event limit; a frame that would exceed it is rejected before input state changes.
Implementations§
Source§impl<A: Action> FixedInput<'_, A>
impl<A: Action> FixedInput<'_, A>
Sourcepub fn focus_lost(&self) -> bool
pub fn focus_lost(&self) -> bool
Reports focus loss in this application frame, even with no held control. True for every catch-up tick in that frame, so cached movement can stop before FrameUpdate. Unlike edges, this boundary is not retained into a later frame with a fixed tick. False outside FixedUpdate.
Sourcepub fn pointer(&self) -> Option<PointerSample>
pub fn pointer(&self) -> Option<PointerSample>
Returns the latest accepted pointer sample for this tick. Retained click edges keep their own earlier samples; later catch-up ticks retain the continuous pointer but do not replay those edges. During FrameUpdate this snapshot returns None. Input resources are not present in Startup.
Sourcepub fn held(&self, action: A) -> bool
pub fn held(&self, action: A) -> bool
Returns whether at least one bound key or mouse button for action is held.
Sourcepub fn has_press_occurrence(&self, action: A) -> bool
pub fn has_press_occurrence(&self, action: A) -> bool
Returns whether this fixed tick contains at least one press occurrence.
Press occurrences survive frames with no fixed tick, appear in the
first later tick, and do not appear in its later catch-up ticks. This
method does not consume them and is independent from aggregate
Self::held state. Use Self::pressed when occurrence count,
order, or intent tokens are needed.
Sourcepub fn has_release_occurrence(&self, action: A) -> bool
pub fn has_release_occurrence(&self, action: A) -> bool
Returns whether this fixed tick contains at least one release occurrence.
Release occurrences follow the same retained first-tick delivery as
Self::has_press_occurrence and are not consumed by this call. It can
return true while Self::held also returns true when another
physical key remains bound to and held for the action. Use
Self::released when occurrence count, order, or intent tokens are
needed.
Sourcepub fn digital_axis(&self, axis: DigitalAxis2d<A>) -> Vec2
pub fn digital_axis(&self, axis: DigitalAxis2d<A>) -> Vec2
Samples four held actions as a raw digital axis.
Each component is exactly -1.0, 0.0, or 1.0; opposite directions
cancel. This performs four held-state lookups without allocation and
does not read or consume action edges. Use
Self::normalized_digital_axis when diagonal movement should retain
cardinal speed.
Sourcepub fn normalized_digital_axis(&self, axis: DigitalAxis2d<A>) -> Vec2
pub fn normalized_digital_axis(&self, axis: DigitalAxis2d<A>) -> Vec2
Samples four held actions as a constant-speed digital direction.
This is exactly equivalent to self.digital_axis(axis).normalized():
no input or mutually cancelled directions produce Vec2::ZERO,
cardinal directions stay unchanged, and non-zero diagonals have unit
length. It performs no allocation and neither reads nor consumes action
edges. Use Self::digital_axis when raw diagonal magnitude or grid
semantics are wanted.
Sourcepub fn pressed(&self, action: A) -> impl Iterator<Item = ActionEdge<A>> + '_
pub fn pressed(&self, action: A) -> impl Iterator<Item = ActionEdge<A>> + '_
Iterates over every queued press occurrence for action in event order.
Sourcepub fn released(&self, action: A) -> impl Iterator<Item = ActionEdge<A>> + '_
pub fn released(&self, action: A) -> impl Iterator<Item = ActionEdge<A>> + '_
Iterates over every queued release occurrence for action in event order.
Trait Implementations§
impl<'w, 's, A: Action> ReadOnlySystemParam for FixedInput<'w, A>where
Res<'w, FixedInputState<A>>: ReadOnlySystemParam,
Source§impl<A: Action> SystemParam for FixedInput<'_, A>
impl<A: Action> SystemParam for FixedInput<'_, A>
Source§type Item<'w, 's> = FixedInput<'w, A>
type Item<'w, 's> = FixedInput<'w, A>
Self, instantiated with new lifetimes. Read moreSource§fn init_access(
state: &Self::State,
system_meta: &mut SystemMeta,
component_access_set: &mut FilteredAccessSet,
world: &mut World,
)
fn init_access( state: &Self::State, system_meta: &mut SystemMeta, component_access_set: &mut FilteredAccessSet, world: &mut World, )
Source§fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
SystemParam’s state.
This is used to apply Commands during ApplyDeferred.Source§fn queue(
state: &mut Self::State,
system_meta: &SystemMeta,
world: DeferredWorld<'_>,
)
fn queue( state: &mut Self::State, system_meta: &SystemMeta, world: DeferredWorld<'_>, )
ApplyDeferred.Source§unsafe fn get_param<'w, 's>(
state: &'s mut Self::State,
system_meta: &SystemMeta,
world: UnsafeWorldCell<'w>,
change_tick: Tick,
) -> Result<Self::Item<'w, 's>, SystemParamValidationError>
unsafe fn get_param<'w, 's>( state: &'s mut Self::State, system_meta: &SystemMeta, world: UnsafeWorldCell<'w>, change_tick: Tick, ) -> Result<Self::Item<'w, 's>, SystemParamValidationError>
SystemParamFunction. Read moreAuto Trait Implementations§
impl<'w, A> Freeze for FixedInput<'w, A>
impl<'w, A> RefUnwindSafe for FixedInput<'w, A>where
Res<'w, FixedInputState<A>>: RefUnwindSafe,
impl<'w, A> Send for FixedInput<'w, A>
impl<'w, A> Sync for FixedInput<'w, A>
impl<'w, A> Unpin for FixedInput<'w, A>
impl<'w, A> UnsafeUnpin for FixedInput<'w, A>where
Res<'w, FixedInputState<A>>: UnsafeUnpin,
impl<'w, A> UnwindSafe for FixedInput<'w, A>where
Res<'w, FixedInputState<A>>: UnwindSafe,
Blanket Implementations§
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
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.