012f54e470 | ||
---|---|---|
.. | ||
res | ||
util | ||
Cargo.toml | ||
README.md | ||
animation.rs | ||
border.rs | ||
button.rs | ||
calculator.rs | ||
config.rs | ||
countdown.rs | ||
cursor.rs | ||
extend_view.rs | ||
focus.rs | ||
gradient.rs | ||
headless.rs | ||
icon.rs | ||
image.rs | ||
layer.rs | ||
localize.rs | ||
markdown.rs | ||
respawn.rs | ||
scroll.rs | ||
shortcuts.rs | ||
text.rs | ||
transform.rs | ||
window.rs |
README.md
Examples
This directory contains small example apps.
Running
To run an example use cargo do run $name
.
Adding an Example
To add an example, create a file then add it in ./Cargo.toml
.
Template
This is a good example template:
In ./foo.rs
:
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use zero_ui::prelude::*;
use zero_ui_view_prebuilt as zero_ui_view;
fn main() {
examples_util::print_info();
// zero_ui_view::run_same_process(app_main);
zero_ui_view::init();
app_main();
}
fn app_main() {
App::default().run_window(async {
Window! {
title = "Foo Example";
child = Text!("Bar");
}
})
}
Then add in ./Cargo.toml
:
[[example]]
name = "foo"
path = "foo.rs"
Then run from the project root using cargo do run foo
.