pub trait GameData:
Debug
+ Sized
+ 'static {
type Action: ActionSet;
type Colors: ColorSet;
type Voice: ClipVariant;
type Settings: GameSettings;
Show 15 methods
// Required methods
fn lang(&self) -> ⟪
fn keymap_def(&self) -> &KeymapDef<Self::Action>;
fn audio_manifest(&self) -> &AudioManifest;
fn palette_def(&self) -> &PaletteDef;
fn console(&self) -> ConsoleSpec;
// Provided methods
fn theme_def(
&self,
theme: <Self::Settings as GameSettings>::Theme,
) -> Option<&PaletteDef> { ... }
fn audio_config(&self) -> AudioConfig { ... }
fn debug_lang(&self) -> Option<&str> { ... }
fn key_text(
&self,
name: &str,
keys: HelpKeys<'_, Self::Action>,
) -> Option<String> { ... }
fn voice_variant(&self) -> Self::Voice { ... }
fn voices(&self, _manifest: &str) -> Result<Playable<Self::Voice>, String> { ... }
fn apply_settings(
&mut self,
_now: &Settings<Self::Settings>,
_before: Option<&Settings<Self::Settings>>,
) { ... }
fn blank_cell(&self, palette: &Palette) -> Cell { ... }
fn keys_before_profiles(&self) -> Vec<String> { ... }
fn old_layout_key(&self) -> Option<&'static str> { ... }
}Expand description
The game’s part of the Ctx, and what the engine reads from the
game’s data through it: its actions, colors, text, keys, audio
manifest and palettes, and the hooks where the game has a say.
Required Associated Types§
Sourcetype Voice: ClipVariant
type Voice: ClipVariant
Which of a voiced line’s clips plays.
Sourcetype Settings: GameSettings
type Settings: GameSettings
The settings the game adds to the engine’s, and their saved form.
Required Methods§
Sourcefn keymap_def(&self) -> &KeymapDef<Self::Action>
fn keymap_def(&self) -> &KeymapDef<Self::Action>
The keymap file: every layout’s default keys, the layout picker’s and the controller buttons.
Sourcefn audio_manifest(&self) -> &AudioManifest
fn audio_manifest(&self) -> &AudioManifest
The sound and music cues.
Sourcefn palette_def(&self) -> &PaletteDef
fn palette_def(&self) -> &PaletteDef
The palette the game starts with, before the settings are read.
Sourcefn console(&self) -> ConsoleSpec
fn console(&self) -> ConsoleSpec
The console the game starts on (Ctx::console).
Provided Methods§
Sourcefn theme_def(
&self,
theme: <Self::Settings as GameSettings>::Theme,
) -> Option<&PaletteDef>
fn theme_def( &self, theme: <Self::Settings as GameSettings>::Theme, ) -> Option<&PaletteDef>
The palette of a color theme; None keeps the palette there is.
By default the game has one palette: always None.
Sourcefn audio_config(&self) -> AudioConfig
fn audio_config(&self) -> AudioConfig
Which of the game’s sound cues the engine’s widgets and screens
play for a menu’s moves and choices and a cursor’s steps: by
default the cues named after what they are
(AudioConfig::DEFAULT).
Sourcefn debug_lang(&self) -> Option<&str>
fn debug_lang(&self) -> Option<&str>
The language only a build with debug tools shows (a test pack), if the game has one: without debug tools it is English.
Sourcefn key_text(
&self,
name: &str,
keys: HelpKeys<'_, Self::Action>,
) -> Option<String>
fn key_text( &self, name: &str, keys: HelpKeys<'_, Self::Action>, ) -> Option<String>
The text of a {name} placeholder that names a key
(Ctx::text_with): by default the cursor keys for {Cursor} and
the key of the action called name (text::key_text); None
leaves it as written.
Sourcefn voice_variant(&self) -> Self::Voice
fn voice_variant(&self) -> Self::Voice
Which clip of a line plays now, where a line has several (who the player made the hero, say). By default the variant’s default: a line’s only clip.
Sourcefn voices(&self, _manifest: &str) -> Result<Playable<Self::Voice>, String>
fn voices(&self, _manifest: &str) -> Result<Playable<Self::Voice>, String>
The clips that may be played, from the text of the voice manifest
the platform read: those whose line still says what they say. Err
says why the manifest can’t be used. By default the game has no
voices, and a manifest is refused.
Sourcefn apply_settings(
&mut self,
_now: &Settings<Self::Settings>,
_before: Option<&Settings<Self::Settings>>,
)
fn apply_settings( &mut self, _now: &Settings<Self::Settings>, _before: Option<&Settings<Self::Settings>>, )
Takes what the settings say that the game draws with (a map’s look,
say): before is what they were (None when they were just
loaded). The engine applies the theme itself.
Sourcefn blank_cell(&self, palette: &Palette) -> Cell
fn blank_cell(&self, palette: &Palette) -> Cell
The cell the frame is cleared to before the screens draw: by default a blank in the engine’s text color on its panel color.
Sourcefn keys_before_profiles(&self) -> Vec<String>
fn keys_before_profiles(&self) -> Vec<String>
The Storage keys the game kept a player’s data under before it
had profiles: a first launch with profiles moves them into the
first one (profiles::migrate). None by default.
Sourcefn old_layout_key(&self) -> Option<&'static str>
fn old_layout_key(&self) -> Option<&'static str>
The Storage key a layout’s name was saved under before the
settings held it, if the game had one: still read when the settings
name none, never written.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".