Skip to main content

InputContext

Struct InputContext 

Source
pub struct InputContext<'a> {
    pub fingerer_rows: &'a [(usize, Rect)],
    pub upgrade_rows: &'a [(usize, Rect)],
    pub help_hits: &'a [(HelpAction, Rect)],
    pub biscuit_rect: Rect,
    pub biscuit_focal: (u16, u16),
    pub golden_rects: [Rect; 3],
    pub green_coin_rect: Rect,
    pub play_area: Rect,
    pub prestige_reset_rect: Rect,
    pub debug: bool,
    pub current: &'a GameState,
}
Expand description

Per-frame geometry the click router hit-tests against. All Rects come from the latest ui::draw output; current is the latest published snapshot. Borrowed for the duration of one event dispatch.

Fields§

§fingerer_rows: &'a [(usize, Rect)]§upgrade_rows: &'a [(usize, Rect)]§help_hits: &'a [(HelpAction, Rect)]§biscuit_rect: Rect§biscuit_focal: (u16, u16)

Screen position of the biscuit’s focal cell. See crate::ui::DrawOutput::biscuit_focal. Used by hands::occupied_at to keep its hit-test math in sync with the visual orbit.

§golden_rects: [Rect; 3]

One rect per Golden variant slot (Lucky/Frenzy/Buff), indexed by GoldenVariant as usize. Each is hit-tested independently so clicking one variant catches only that variant.

§green_coin_rect: Rect

Hit-test rect for the on-screen Green Coin marker. Zero-rect when no coin is visible; click-routes through Action::CatchGreenCoin.

§play_area: Rect§prestige_reset_rect: Rect§debug: bool§current: &'a GameState

Implementations§

Source§

impl<'a> InputContext<'a>

Source

pub fn from_layout( layout: &'a DrawOutput, current: &'a GameState, debug: bool, ) -> Self

Build an input context by borrowing from a render DrawOutput.

The platform shells (app.rs, wasm_app.rs) call this so adding a new clickable region only touches DrawOutput + InputContext + this projection — never the platform code. Without this single projection point, native and wasm each kept their own field-by-field copy of the layout snapshot, and a new field meant updating both; the wasm build broke once when only the native copy was updated.

Auto Trait Implementations§

§

impl<'a> Freeze for InputContext<'a>

§

impl<'a> RefUnwindSafe for InputContext<'a>

§

impl<'a> Send for InputContext<'a>

§

impl<'a> Sync for InputContext<'a>

§

impl<'a> Unpin for InputContext<'a>

§

impl<'a> UnsafeUnpin for InputContext<'a>

§

impl<'a> UnwindSafe for InputContext<'a>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.