#[non_exhaustive]pub struct Start<G>where
G: GameData,{
pub card: Card,
pub load: Box<dyn FnOnce(Setup) -> Result<Game<G>, String>>,
pub look: fn(&G) -> Look<'_>,
pub on_system: Option<fn(&mut Game<G>, SystemEvent)>,
pub made: Option<Made>,
pub state_hash: Option<fn(&Game<G>) -> Option<StateHash>>,
pub crash_record: Option<fn(&Game<G>) -> Option<String>>,
}Expand description
How a game starts: the card shown while it loads, the load, where its
look is and its hook for the system’s events. Built with Start::new,
its optional parts set by the methods named for them (ADR-0039).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.card: CardWhat the first frame shows.
load: Box<dyn FnOnce(Setup) -> Result<Game<G>, String>>Runs on the second frame, the card on the screen.
look: fn(&G) -> Look<'_>What the game’s frames are painted with.
on_system: Option<fn(&mut Game<G>, SystemEvent)>The game’s hook for the system’s events, if it has one.
made: Option<Made>The build’s stamp, copied into a session record.
state_hash: Option<fn(&Game<G>) -> Option<StateHash>>The game’s own state hash, in each frame’s hash.
crash_record: Option<fn(&Game<G>) -> Option<String>>The game’s record of its play, for a crash report.
Implementations§
Source§impl<G> Start<G>where
G: GameData,
impl<G> Start<G>where
G: GameData,
Sourcepub fn new(
card: Card,
look: fn(&G) -> Look<'_>,
load: impl FnOnce(Setup) -> Result<Game<G>, String> + 'static,
) -> Start<G>
pub fn new( card: Card, look: fn(&G) -> Look<'_>, load: impl FnOnce(Setup) -> Result<Game<G>, String> + 'static, ) -> Start<G>
A game that shows card, then loads with load, painted with what
look finds in its data.
Sourcepub fn on_system(self, hook: fn(&mut Game<G>, SystemEvent)) -> Start<G>
pub fn on_system(self, hook: fn(&mut Game<G>, SystemEvent)) -> Start<G>
The same start with the game’s hook for the system’s events.
Sourcepub fn made(self, made: Made) -> Start<G>
pub fn made(self, made: Made) -> Start<G>
The same start with the build’s stamp, copied into a session record
and checked when one is played (session::prepare).
Sourcepub fn state_hash(self, hash: fn(&Game<G>) -> Option<StateHash>) -> Start<G>
pub fn state_hash(self, hash: fn(&Game<G>) -> Option<StateHash>) -> Start<G>
The same start with the game’s own state hash, in each frame’s hash
(App::frame_hash): so a playback that plays differently is found
at the frame the game’s state moved, not only when a screen or a
sound shows it.
Sourcepub fn crash_record(self, hook: fn(&Game<G>) -> Option<String>) -> Start<G>
pub fn crash_record(self, hook: fn(&Game<G>) -> Option<String>) -> Start<G>
The same start with the game’s record of its play, which a backend
that catches a panic adds to its crash report
(App::crash_record). A record should not hold what the player
typed (a name).
Sourcepub fn before_load(self, before: impl FnOnce(&mut Setup) + 'static) -> Start<G>
pub fn before_load(self, before: impl FnOnce(&mut Setup) + 'static) -> Start<G>
The same start with before run on the setup ahead of the game’s
load: a backend’s own part (the voice manifest it read).