Skip to main content

shuyi_assets/
lib.rs

1//! Shuyi Engine's assets: the bundle of files a game embeds, laid in layers
2//! the game gives ([`bundle`]), errors that name a file, line and column
3//! ([`error`]), and RON files read with those errors ([`ron`]). On top of
4//! them, the kinds of file every game has: images ([`image`]) and their
5//! one-bit versions ([`bitmap`]), a font atlas
6//! ([`font`]), named colours ([`palette`], [`ink`]) and their one-bit
7//! patterns ([`onebit`]), lights ([`lighting`]),
8//! the audio manifest ([`audio`]) and the credits ([`credits`]); the `.map`
9//! text format of a grid map ([`grid_map`]) and a tileset's terrain tiles
10//! ([`tileset`]); keymap files, generic over a
11//! game's actions ([`keymap`]); and the text of a story game:
12//! languages ([`lang`]), a names table ([`names`]), dialogue scripts
13//! ([`dialogue`]), voice clips by line ([`voice`]), tips ([`tip`]) and
14//! word wrap for text boxes ([`text`]); and
15//! cinematics, timed shots of a game's own kinds ([`cinematic`]); and
16//! export targets' profiles ([`target`]). Each
17//! is a pure parser; the game names its files, says what its own rules add,
18//! and reads them from its bundle.
19//!
20//! Formats are plugins ([`format`](mod@format), ADR-0007): each kind of
21//! asset is a plain type, the parsers above are formats of their kinds,
22//! and a game registers its own kinds and formats beside the engine's in
23//! a [`Formats`] registry, then asks it for an asset by id. A game may
24//! ship its assets baked into one [`pack`] (`.shuyipak`), proven equal to
25//! its sources. A value read through the registry can reload when its files
26//! change on disk ([`hot`]).
27//!
28//! For tests, behind the `golden` feature: golden tables (`golden`),
29//! values a build gives pinned in a file, the same on every platform.
30#![cfg_attr(not(feature = "std"), no_std)]
31
32extern crate alloc;
33
34/// What `std`'s prelude gives for free, for the `no_std` build.
35mod prelude {
36    pub use alloc::borrow::ToOwned;
37    pub use alloc::boxed::Box;
38    pub use alloc::string::{String, ToString};
39    pub use alloc::vec::Vec;
40    pub use alloc::{format, vec};
41}
42
43pub mod audio;
44pub mod bitmap;
45pub mod bundle;
46pub mod cinematic;
47pub mod credits;
48pub mod dialogue;
49pub mod error;
50pub mod fnv;
51pub mod font;
52pub mod format;
53#[cfg(feature = "golden")]
54pub mod golden;
55pub mod grid_map;
56pub mod hot;
57pub mod image;
58pub mod import_settings;
59pub mod ink;
60pub mod keymap;
61pub mod lang;
62pub mod lighting;
63pub mod names;
64pub mod onebit;
65pub mod pack;
66pub mod palette;
67pub mod ron;
68pub mod target;
69pub mod text;
70pub mod tileset;
71pub mod tip;
72pub mod voice;
73
74pub use bundle::{Bundle, Files, Layer};
75pub use error::{ContentError, ContentErrors, line_of};
76pub use format::{AssetKind, AssetPath, DecodeCx, Encode, Format, Formats, Limits};
77pub use grid_map::{GridMap, MapFeature, MapFormat, MapLook};
78pub use ron::parse_ron;