pub struct FrameInput<'w, A: Action> { /* private fields */ }Expand description
Read-only logical input for the current FrameUpdate delivery.
This custom System parameter deliberately exposes no ResMut path to the
runtime-owned snapshot.
Implementations§
Source§impl<A: Action> FrameInput<'_, A>
impl<A: Action> FrameInput<'_, A>
Sourcepub fn scroll_events(&self) -> impl Iterator<Item = PointerScrollEvent> + '_
pub fn scroll_events(&self) -> impl Iterator<Item = PointerScrollEvent> + '_
Iterates over wheel events in physical order, retaining fractional line or logical-pixel units and event-time pointers. Events are frame-only, even while paused, and a focus-loss frame has no wheel events.
Sourcepub fn events(&self) -> impl Iterator<Item = FrameInputEvent<A>> + '_
pub fn events(&self) -> impl Iterator<Item = FrameInputEvent<A>> + '_
Interleaves action edges and wheel occurrences in physical event order. Use this when a wheel changes the camera used to interpret nearby clicks. Synthesized cancellation releases retain their normal ordering. Each queue has the input event limit; the merged view allocates no storage.
Sourcepub fn relative_motion(&self) -> RelativePointerMotion
pub fn relative_motion(&self) -> RelativePointerMotion
Returns this frame’s raw displacement. Apply sensitivity once, without delta-time scaling. No fixed-tick delivery or transition replay occurs.
Sourcepub fn focus_lost(&self) -> bool
pub fn focus_lost(&self) -> bool
Reports a focus-loss boundary even when no mapped control was held. All relative motion and wheel events in that accepted batch are discarded.
Sourcepub fn pointer(&self) -> Option<PointerSample>
pub fn pointer(&self) -> Option<PointerSample>
Returns the latest accepted pointer sample, or None before motion or
after leaving. Inactive-stage snapshots are empty. Use an action edge’s
ActionEdge::pointer for the position of a particular click.
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 frame contains at least one press occurrence.
This does not consume the occurrence and is independent from aggregate
Self::held state: another physical key for the same action may
already be held, and one frame may contain both press and release
occurrences. 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 frame contains at least one release occurrence.
This does not consume the occurrence. It can return true while
Self::held also returns true when another physical key remains
bound to and held for the same 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 press occurrence for action in event order.
Sourcepub fn edges(&self) -> impl Iterator<Item = ActionEdge<A>> + '_
pub fn edges(&self) -> impl Iterator<Item = ActionEdge<A>> + '_
Iterates over all action edges in physical event order.
Use this for gestures whose presses and releases can both arrive in one display frame. Each mouse edge keeps its own event-time pointer; the latest pointer is not necessarily the release endpoint.
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 release occurrence for action in event order.
Trait Implementations§
impl<'w, 's, A: Action> ReadOnlySystemParam for FrameInput<'w, A>where
Res<'w, FrameInputState<A>>: ReadOnlySystemParam,
Source§impl<A: Action> SystemParam for FrameInput<'_, A>
impl<A: Action> SystemParam for FrameInput<'_, A>
Source§type Item<'w, 's> = FrameInput<'w, A>
type Item<'w, 's> = FrameInput<'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 FrameInput<'w, A>
impl<'w, A> RefUnwindSafe for FrameInput<'w, A>where
Res<'w, FrameInputState<A>>: RefUnwindSafe,
impl<'w, A> Send for FrameInput<'w, A>
impl<'w, A> Sync for FrameInput<'w, A>
impl<'w, A> Unpin for FrameInput<'w, A>
impl<'w, A> UnsafeUnpin for FrameInput<'w, A>where
Res<'w, FrameInputState<A>>: UnsafeUnpin,
impl<'w, A> UnwindSafe for FrameInput<'w, A>where
Res<'w, FrameInputState<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.