Expand description
.yres resource files — a mod’s texts, images, sounds, files, colors,
numbers and flags, like a C# project’s Resources/*.resx. See
Yog-IDLE’s docs/yres.md for the format.
yog build reads resources/**/*.yres: <Set>.yres is the neutral
(en_us) file of resource set <Set>, <Set>.<locale>.yres its culture
variants (texts only). It
- writes the texts into
assets/<mod id>/lang/<locale>.json(merged with a hand-written one),{name}/{0}placeholders turned into%1$s; - bundles image/file/sound entries’ files under
assets/<mod id>/...(sounds as Ogg Vorbis:.ysoundevents name them); - generates
obj/generated/resources/<Set>.g.rs— a type per set with a typed accessor per entry — andresources.g.rsincluding them, pulled in ascrate::resbyyog_api::resources!();; - resolves
@<Set>.<name>references for.yuiscreens andyog.toml.
Structs§
- Compiled
- Everything
yog buildmakes of a mod’s resources. - Entry
- One entry of a
.yresfile. - Refs
- What
.yuiscreens andyog.tomlcan refer to as@<Set>.<name>.
Enums§
- Kind
- An entry’s type.
- Value
- A scalar as written: a string, a number (its literal), a bool, or bytes
(a picture, a sound, a file —
@bytes:<base64>).
Constants§
- GENERATED_
DIR - Where the per-set
<Set>.g.rsfiles go. - GENERATED_
FILE - Where the generated accessors go, under the mod root.
The file
yog_api::resources!()includes; it includes oneresources/<Set>.g.rsper set (shown under its.yresin Yog-IDLE). - GENERATED_
SCRIPT - The generated Yog Script of every set (
Res.<Set>.<Entry>). - NEUTRAL_
LOCALE - The locale of the neutral
<Set>.yresfiles.
Functions§
- compile
- Compiles the mod’s resources (see the module docs). Any error fails the whole thing, listing every problem.
- parse
- Parses
.yrestext: its entries, or every problem, each with its code and place; names aren’t validated here (see [valid_name]). - resolve_
image - Resolves a
yog.tomlimage value:@<Set>.<name>→ its image source. - resolve_
text - Resolves a
yog.tomlvalue:@<Set>.<name>of a text → (neutral text, Some(key)); anything else as is. Errors on an unknown reference. - write
.yrestext forentries, as the IDE writes it.- write_
sources - Writes
obj/generated/resources/<Set>.g.rsper set andobj/generated/resources.g.rsincluding them all (whatyog_api::resources!()pulls in ascrate::res); deletes those of sets that are gone.