Skip to main content

UiState

Struct UiState 

Source
pub struct UiState { /* private fields */ }
Expand description

Small immediate UI interaction state. Response storage is reused after its high-water mark; hit testing/navigation is linear in the submitted regions. Update once per fixed tick before gameplay, then draw the responses.

Implementations§

Source§

impl UiState

Source

pub fn with_capacity(regions: usize) -> Self

Preallocates response storage, including one removed-capture cancellation.

Source

pub fn focused(&self) -> Option<UiId>

Focused region, retained by identity across reordering and resizing.

Source

pub fn response(&self, id: UiId) -> Option<&UiResponse>

Current response. A removed captured region is retained for one update with cancelled = true, allowing game-owned drag cleanup.

Source

pub fn responses(&self) -> &[UiResponse]

All current responses in region order, then any removed capture event.

Source

pub fn update(&mut self, regions: &[UiRegion], input: UiInput) -> UiCapture

Resolves focus and pointer capture using the current layout. Releasing outside does not activate a button; drags retain capture outside/bars. Simultaneous next/previous presses cancel navigation. Pointer capture suspends keyboard navigation/activation until it ends.

Trait Implementations§

Source§

impl Default for UiState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Component for T
where T: Send + Sync + 'static,

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, 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.