pub struct TitleMenu { /* private fields */ }Expand description
A vertical title-screen menu with a blinking “press start” prompt.
Implementations§
Source§impl TitleMenu
impl TitleMenu
Sourcepub fn new(items: Vec<TitleItem>) -> Self
pub fn new(items: Vec<TitleItem>) -> Self
Build a menu from entries, landing the cursor on the first enabled one.
Sourcepub fn with_blink_period(self, frames: u32) -> Self
pub fn with_blink_period(self, frames: u32) -> Self
Override the blink period (frames on = frames off). Clamped to ≥1.
Sourcepub fn update(&mut self, input: &InputState) -> TitleEvent
pub fn update(&mut self, input: &InputState) -> TitleEvent
Advance one frame: Up/Down move the cursor to the nearest enabled entry, A/Start confirm the current entry (if enabled), and the blink timer ticks.
Sourcepub fn show_blink(&self) -> bool
pub fn show_blink(&self) -> bool
Whether the blink prompt is currently visible (first half of the period).
Sourcepub fn write_context(&self, ctx: &mut DataContext)
pub fn write_context(&self, ctx: &mut DataContext)
Write this menu’s state into ctx for the .gui title layout:
items: the list of entry labels (bind alisttosource = "{items}"),cursor: the selected index (selected = "{cursor}"),show_blink: whether a “press start” prompt is visible this frame (visible = "{show_blink}").
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TitleMenu
impl RefUnwindSafe for TitleMenu
impl Send for TitleMenu
impl Sync for TitleMenu
impl Unpin for TitleMenu
impl UnsafeUnpin for TitleMenu
impl UnwindSafe for TitleMenu
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
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>
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)
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)
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.