Expand description
.yui screen files — the declarative form of a yog-ui widget tree that
Yog-IDLE’s screen designer edits — and their code generation.
A .yui file is a small XAML-like XML document: one element per widget,
attributes named after the yog-ui builder methods they become:
<Screen id="mymod:main_menu" width="176" height="166" anchor="center" bg="#C0101010" padding="8">
<Label id="title" x="8" y="6" text="Main Menu" color="#FFFFFF" no_wrap="true"/>
<Button x="38" y="40" w="100" h="20" text="Play" bg="#FF555555" on_click="play"/>
<Column x="8" y="70" w="160" gap="2">
<Label text="Flowing child"/>
</Column>
</Screen>yog build (and yog check, yog ui gen) turns src/**/foo.yui into
.yog-build/generated/**/foo.g.rs — WPF’s MainWindow.g.cs: generated
into the build directory on every build, never committed, pulled into the
screen’s hand-written code-behind module with yog_api::ui_include!("foo").
See docs/yui.md in Yog-IDLE for the full format.
Structs§
- Element
- One XML element: name, attributes in source order, child elements.
Constants§
- GENERATED_
DIR - Where generated screen code goes, under the project root.
Functions§
- color
#RRGGBB,#AARRGGBBor0xAARRGGBB→0xAARRGGBB.- const_
name - A Rust constant name for an event/widget id:
mymod:btn-play→MYMOD_BTN_PLAY. - find_
yui_ files - Every
.yuifile underdir, recursively. - generate
- Generates the
.g.rssource for a.yuidocument.nameis the screen’s path undersrc/without the extension (mod_list,screens/options): what the code-behind passes toui_include!. - generate_
all yog build’s step: regenerates everysrc/**/*.yui’s.g.rsand drops generated files whose.yuiis gone.- generate_
file - Generates
.yog-build/generated/<name>.g.rsfor one.yuifile of the project atroot— only rewritten when the output changed, so cargo doesn’t rebuild for nothing. - generate_
for generatefor the modmod_id(resolvesmod:image sources), also returningline N: ...warnings.- generated_
path - Where
src/<name>.yui’s generated code goes:.yog-build/generated/<name>.g.rs. - include_
name foo.yui’s name forui_include!: its path undersrc/without the extension,/-separated (mod_list,screens/options).- parse_
xml - Parses an XML document (the subset
.yuiuses) into its root element. - pascal
stat_bar/my-mod→StatBar/MyMod.- project_
root - The project root (the folder with
yog.toml) a.yuifile belongs to. - set_
resource_ refs - Makes the mod’s compiled
.yresresources visible to the generator:text="@Strings.title"andsource="@Icons.logo"resolve through them. - text_
expr - The Rust expression for a text attribute:
"@mymod.key"is translation keymymod.key, looked up when the tree is built (::yog_api::tr, so it follows the game’s language);"@@..."is a literal text starting with@; anything else is the literal text.