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
impl UiState
Sourcepub fn with_capacity(regions: usize) -> Self
pub fn with_capacity(regions: usize) -> Self
Preallocates response storage, including one removed-capture cancellation.
Sourcepub fn focused(&self) -> Option<UiId>
pub fn focused(&self) -> Option<UiId>
Focused region, retained by identity across reordering and resizing.
Sourcepub fn response(&self, id: UiId) -> Option<&UiResponse>
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.
Sourcepub fn responses(&self) -> &[UiResponse]
pub fn responses(&self) -> &[UiResponse]
All current responses in region order, then any removed capture event.
Sourcepub fn update(&mut self, regions: &[UiRegion], input: UiInput) -> UiCapture
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.