pub struct OptionsScreen<G: GameData> { /* private fields */ }Expand description
The options screen. Cancel closes it, asking first if anything changed.
Implementations§
Source§impl<G: GameData> OptionsScreen<G>
impl<G: GameData> OptionsScreen<G>
Sourcepub const NAME: &'static str = "options"
pub const NAME: &'static str = "options"
Name reported by Screen::name.
Sourcepub fn painted_by(self, paint: Paint<G>) -> Self
pub fn painted_by(self, paint: Paint<G>) -> Self
The same screen with its view painted by paint instead of
glyph::paint: a game’s look for a device of its own.
Sourcepub fn focused_on(self, key: &'static str) -> Self
pub fn focused_on(self, key: &'static str) -> Self
The same screen focused on the row key (on the first row while
that one isn’t shown).
Sourcepub fn rows(&self, ctx: &Ctx<G>) -> Vec<OptionRow<G>>
pub fn rows(&self, ctx: &Ctx<G>) -> Vec<OptionRow<G>>
The rows ctx shows, top to bottom: the game’s, less the
Fullscreen row (OptionRow::fullscreen’s key) where the game
isn’t in a window (PlatformFacts::windowed): a device that is
always full screen.
Sourcepub fn leaving(&self) -> Option<LeaveChoice>
pub fn leaving(&self) -> Option<LeaveChoice>
The answer in focus while the question asked on leaving with changes is open.
Sourcepub fn changed(&self, ctx: &Ctx<G>) -> bool
pub fn changed(&self, ctx: &Ctx<G>) -> bool
Whether any setting, or any row that isn’t one, differs from when the screen opened (the layout aside: it is saved when picked).
Sourcepub fn value(ctx: &Ctx<G>, row: &OptionRow<G>) -> ValueView
pub fn value(ctx: &Ctx<G>, row: &OptionRow<G>) -> ValueView
What row shows beside its name. (The volume box, while open, is
the screen’s: view.)
Sourcepub fn view(&self, ctx: &Ctx<G>) -> OptionsView
pub fn view(&self, ctx: &Ctx<G>) -> OptionsView
The screen as it is now, as plain data for a skin to paint
(glyph::paint): every row with its name and value, the row in
focus, the volume box if it is open, the message, the question and
the help line, all in the player’s language and naming their keys.
Trait Implementations§
Source§impl<G: GameData> Debug for OptionsScreen<G>
impl<G: GameData> Debug for OptionsScreen<G>
Source§impl<G: GameData> Screen<G> for OptionsScreen<G>
impl<G: GameData> Screen<G> for OptionsScreen<G>
Source§fn actions(&self) -> Option<Vec<G::Action>>
fn actions(&self) -> Option<Vec<G::Action>>
Its rows, its questions and the volume box on a controller.
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