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 powerup_rects: &'a [(u64, 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.
powerup_rects: &'a [(u64, Rect)](spawn_id, rect) for every on-screen powerup. Click hit-test
walks this list and routes the first match to
Action::CatchPowerup(spawn_id). The g hotkey min_by_key’s it
for the most-urgent. Both reference instances by id, never by
Vec index — swap_remove on catch is safe.
play_area: Rect§prestige_reset_rect: Rect§debug: bool§current: &'a GameStateImplementations§
Source§impl<'a> InputContext<'a>
impl<'a> InputContext<'a>
Sourcepub fn from_layout(
layout: &'a DrawOutput,
current: &'a GameState,
debug: bool,
) -> Self
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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