Skip to main content

BasicData

Struct BasicData 

Source
pub struct BasicData<A, T = ()>
where A: ActionSet, T: Debug + 'static,
{ pub font: FontAtlasDef, pub images: ImageTable, pub bundle: Bundle, pub own: T, /* private fields */ }
Expand description

A game’s data on the short path: what the engine reads from the standard files, the files themselves and the game’s own part T. Its actions are A (most simply UiAction), its colours the engine’s.

Fields§

§font: FontAtlasDef

The font atlas.

§images: ImageTable

Every picture of the bundle but the font’s.

§bundle: Bundle

The bundle the data was read from: the pictures’ bytes.

§own: T

The game’s own part.

Implementations§

Source§

impl<A, T> BasicData<A, T>
where A: ActionSet, T: Debug + 'static,

Source

pub fn formats() -> Formats

The formats it reads with: the engine’s standard ones, the palette with the engine’s colours and the font atlas with BASIC_GLYPHS in their place, the keymap of A and the English.

Source

pub fn load( bundle: Bundle, console: ConsoleSpec, own: fn(&Bundle) -> Result<T, Vec<ContentError>>, ) -> Result<BasicData<A, T>, Vec<ContentError>>

The data in bundle, on console, with the game’s own part read by own; or every problem of every file at once, each naming its file.

Trait Implementations§

Source§

impl<A, T> Debug for BasicData<A, T>
where A: Debug + ActionSet, T: Debug + 'static,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<A, T> GameData for BasicData<A, T>
where A: ActionSet, T: Debug + 'static,

Source§

type Action = A

The game’s input actions.
Source§

type Colors = EngineColor

The colors the game’s code draws with.
Source§

type Voice = ()

Which of a voiced line’s clips plays.
Source§

type Settings = ()

The settings the game adds to the engine’s, and their saved form.
Source§

fn lang(&self) -> &Lang

The screen text by key, in every language.
Source§

fn keymap_def(&self) -> &KeymapDef<A>

The keymap file: every layout’s default keys, the layout picker’s and the controller buttons.
Source§

fn audio_manifest(&self) -> &AudioManifest

The sound and music cues.
Source§

fn palette_def(&self) -> &PaletteDef

The palette the game starts with, before the settings are read.
Source§

fn console(&self) -> ConsoleSpec

The console the game starts on (Ctx::console).
Source§

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.
Source§

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).
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.

Auto Trait Implementations§

§

impl<A, T> Freeze for BasicData<A, T>
where T: Freeze,

§

impl<A, T> RefUnwindSafe for BasicData<A, T>

§

impl<A, T> Send for BasicData<A, T>
where T: Send, A: Send,

§

impl<A, T> Sync for BasicData<A, T>
where T: Sync, A: Sync,

§

impl<A, T> Unpin for BasicData<A, T>
where T: Unpin,

§

impl<A, T> UnsafeUnpin for BasicData<A, T>
where T: UnsafeUnpin,

§

impl<A, T> UnwindSafe for BasicData<A, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.