pub struct LayoutPickerScreen<G: GameData> { /* private fields */ }Expand description
Shows every layout and saves the one picked. Asked for by a key press while no layout is chosen, it can’t be cancelled with a key (the keyboard needs a layout), but any controller button closes it without choosing: that player is on the controller. Pops itself once a layout is picked.
Implementations§
Source§impl<G: GameData> LayoutPickerScreen<G>
impl<G: GameData> LayoutPickerScreen<G>
Sourcepub const NAME: &'static str = "layout_picker"
pub const NAME: &'static str = "layout_picker"
Its Screen::name.
Sourcepub fn new(ctx: &Ctx<G>, legend: &'static Legend<G::Action>) -> Self
pub fn new(ctx: &Ctx<G>, legend: &'static Legend<G::Action>) -> Self
The picker with the first layout focused, its legend listing
legend.
Sourcepub fn change(ctx: &Ctx<G>, legend: &'static Legend<G::Action>) -> Self
pub fn change(ctx: &Ctx<G>, legend: &'static Legend<G::Action>) -> Self
The picker as the options open it, to switch layout: the layout in use focused, and Cancel backs out without changing anything.
Sourcepub fn focused(&self) -> Option<Layout>
pub fn focused(&self) -> Option<Layout>
The focused layout (None only for a keymap with no layouts, which
the loader refuses).
Sourcepub fn help(ctx: &Ctx<G>) -> String
pub fn help(ctx: &Ctx<G>) -> String
The bottom help line: every Cursor up and Cursor down key, then every Confirm key, from the active keymap (before any layout is chosen, the layout picker’s own keys).
Sourcepub fn legend(&self, ctx: &Ctx<G>, km: &Keymap<G::Action>) -> Vec<LegendRow>
pub fn legend(&self, ctx: &Ctx<G>, km: &Keymap<G::Action>) -> Vec<LegendRow>
The legend for km, in ctx’s language: the keys and what they
do; an action with no key shows ! not mapped. Always its keyboard
keys: the screen is about the keyboard’s layouts.
Sourcepub fn view(&self, ctx: &Ctx<G>) -> LayoutPickerView
pub fn view(&self, ctx: &Ctx<G>) -> LayoutPickerView
The screen as it is now, as plain data for a skin to paint
(glyph::paint): each layout with its legend and what every key
of its keyboard does, the one in focus, and the help line.
Trait Implementations§
Source§impl<G: GameData> Clone for LayoutPickerScreen<G>
impl<G: GameData> Clone for LayoutPickerScreen<G>
Source§impl<G: GameData> Debug for LayoutPickerScreen<G>
impl<G: GameData> Debug for LayoutPickerScreen<G>
Source§impl<G: GameData> Screen<G> for LayoutPickerScreen<G>
impl<G: GameData> Screen<G> for LayoutPickerScreen<G>
Source§fn update(
&mut self,
ctx: &mut Ctx<G>,
input: &FrameInput<G::Action>,
) -> Transition<G>
fn update( &mut self, ctx: &mut Ctx<G>, input: &FrameInput<G::Action>, ) -> Transition<G>
input holds this frame’s actions (often none)
and elapsed time. Called only while this screen is on top.Source§fn draw(&self, ctx: &Ctx<G>, buf: &mut GlyphBuffer)
fn draw(&self, ctx: &Ctx<G>, buf: &mut GlyphBuffer)
Source§fn as_any(&self) -> Option<&dyn Any>
fn as_any(&self) -> Option<&dyn Any>
Any, for tests that look inside a screen on the
stack (ScreenStack::find). None unless the screen opts in.Source§fn debug_draw(&self, ctx: &Ctx<G>, out: &mut Gizmos)
fn debug_draw(&self, ctx: &Ctx<G>, out: &mut Gizmos)
self
and ctx alone, so looking changes nothing. A channel’s helper
(the grid kit’s layout_gizmos)
does the work. Called after draw on every screen
drawn, bottom up, only while debug tools are on
(Ctx::debug_tools). Does nothing unless the screen has
something to show.Source§fn is_overlay(&self) -> bool
fn is_overlay(&self) -> bool
Source§fn state_hash(&self) -> Option<StateHash>
fn state_hash(&self) -> Option<StateHash>
Game::state_hash), most simply
shuyi_core::state_hash(&self.rules).ok(): so a playback that plays
differently is found at the frame the state moved. None unless the
screen opts in.Source§fn as_any_mut(&mut self) -> Option<&mut dyn Any>
fn as_any_mut(&mut self) -> Option<&mut dyn Any>
as_any, mutable (ScreenStack::find_mut).Source§fn covered(&mut self, _ctx: &mut Ctx<G>)
fn covered(&mut self, _ctx: &mut Ctx<G>)
Transition::Push): it is no longer updated until it is
uncovered. Not called when the screen above
swaps itself for another (Transition::Replace). Does nothing
unless the screen needs it.Source§fn uncovered(
&mut self,
ctx: &mut Ctx<G>,
result: Option<ScreenResult>,
) -> Transition<G>
fn uncovered( &mut self, ctx: &mut Ctx<G>, result: Option<ScreenResult>, ) -> Transition<G>
result is what it popped with (Transition::PopWith), None
after a plain Transition::Pop. The transition returned is
applied at once, as if from update, so a screen
can act on the answer in the same frame: push the next screen, or
pop with an answer of its own. By default, nothing happens. Read more