chirp
file format| ❗ A syntax overall is expected in 0.10.0!!! Beware ❗ | |------------------------------------------------------------|
The .chirp
file format is a general bevy scene text file format. It was
designed to look as close as possible to the [dsl!
] macro from cuicui_dsl
.
It just so happen that all cuicui
crates are compatible with .chirp
files.
It is a custom file format. The parser is written using winnow
and directly
interprets the bits.
It provides a bevy Plugin
to load .chirp
files with the AssetServer
as
scenes.
First, write the chirp file:
ron
// file: <scene.chirp>
// Use screen_root to follow the screen's boundaries
row(screen_root) {
row(margin 9, border(5, cyan), bg navy) {
spawn(text "Hello world!");
}
}
Second, add the plugin and load the chirp file:
```rust,norun
use bevy::prelude::*;
use cuicuidsl::BaseDsl;
use cuicui_chirp::Chirp;
fn main() {
// Do not forget to add cuicuilayoutbevy{ui,sprite}::Plugin
// and cuicuichirp::loader::Plugin with the wanted DSL as type parameter
App::new().addplugins((
DefaultPlugins,
cuicuichirp::loader::Plugin::new::
See the cuicui_layout
repository root README for more details.
dsl!
macroReflectDsl
]. It implements ParseDsl
based on a Reflect + Bundle
type. No such thing is possible with the dsl!
macro..chirp
files support arbitrary syntax. For example, we use [css-color
]
to parse colors.dsl!
macroDslBundle
. The trait
in question is ParseDsl
. You may use parse_dsl_impl
to make this easy.FileAssetIo
.Both crates are not mutually exclusive.
You can prototype with a .chirp
file, then copy the chirp content
into a dsl!
macro. This is how the chirpunk
example was built.
macros
(default): Define the parse_dsl_impl
macro. If you are not using
the proc macro and defining ParseDsl
implementations manually, you can
disable this feature for faster compile times.load_font
and load_image
(default): Enable loading Font
and Image
assets from .chirp
files. Disable those features if you are not using Font
s
or Image
sfancy_errors
(default): Show position in source code when failing to parse
.chirp
files.