Skip to main content

FixedInput

Struct FixedInput 

Source
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>

Source

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.

Source

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.

Source

pub fn held(&self, action: A) -> bool

Returns whether at least one bound key or mouse button for action is held.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn pressed(&self, action: A) -> impl Iterator<Item = ActionEdge<A>> + '_

Iterates over every queued press occurrence for action in event order.

Source

pub fn released(&self, action: A) -> impl Iterator<Item = ActionEdge<A>> + '_

Iterates over every queued release occurrence for action in event order.

Trait Implementations§

Source§

impl<'w, 's, A: Action> ReadOnlySystemParam for FixedInput<'w, A>
where Res<'w, FixedInputState<A>>: ReadOnlySystemParam,

Source§

impl<A: Action> SystemParam for FixedInput<'_, A>

Source§

type State = FetchState<A>

Used to store data which persists across invocations of a system.
Source§

type Item<'w, 's> = FixedInput<'w, A>

The item type returned when constructing this system param. The value of this associated type should be Self, instantiated with new lifetimes. Read more
Source§

fn init_state(world: &mut World) -> Self::State

Creates a new instance of this param’s State.
Source§

fn init_access( state: &Self::State, system_meta: &mut SystemMeta, component_access_set: &mut FilteredAccessSet, world: &mut World, )

Registers any World access used by this SystemParam. Read more
Source§

fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)

Applies any deferred mutations stored in this SystemParam’s state. This is used to apply Commands during ApplyDeferred.
Source§

fn queue( state: &mut Self::State, system_meta: &SystemMeta, world: DeferredWorld<'_>, )

Queues any deferred mutations to be applied at the next 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>

Creates a parameter to be passed into a SystemParamFunction. Read more

Auto Trait Implementations§

§

impl<'w, A> Freeze for FixedInput<'w, A>
where Res<'w, FixedInputState<A>>: Freeze,

§

impl<'w, A> RefUnwindSafe for FixedInput<'w, A>
where Res<'w, FixedInputState<A>>: RefUnwindSafe,

§

impl<'w, A> Send for FixedInput<'w, A>
where Res<'w, FixedInputState<A>>: Send,

§

impl<'w, A> Sync for FixedInput<'w, A>
where Res<'w, FixedInputState<A>>: Sync,

§

impl<'w, A> Unpin for FixedInput<'w, A>
where Res<'w, FixedInputState<A>>: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more