zng/examples
Samuel Guerra 0f95203254 More docs review. 2024-02-08 01:07:30 -03:00
..
res Fixed markdown list item with block children. 2024-01-19 19:00:37 -03:00
util Fixed webrender warning suppression. 2023-10-23 18:56:33 -03:00
Cargo.toml Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
README.md Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
animation.rs Demonstrates rendered image caching in animation example again. 2024-01-30 16:27:57 -03:00
border.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
button.rs Fixed image usage in examples. 2024-01-18 18:57:42 -03:00
calculator.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
config.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
countdown.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
cursor.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
extend_view.rs Renamed wgt_prelude to prelude_wgt. 2024-01-05 12:45:09 -03:00
focus.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
gradient.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
headless.rs More docs review. 2024-02-08 01:07:30 -03:00
icon.rs Added wrap docs. 2024-01-26 12:35:12 -03:00
image.rs Changed center_viewport demo to include the zoom scale. 2024-01-24 15:23:47 -03:00
layer.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
localize.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
markdown.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
respawn.rs Fixed image usage in examples. 2024-01-18 18:57:42 -03:00
scroll.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
shortcuts.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
text.rs Added undo docs. 2024-01-27 19:41:59 -03:00
transform.rs Added view-process crates to main crate with non-default features. 2024-01-18 18:44:58 -03:00
window.rs Removed `WindowChrome` type. 2024-02-06 15:02:53 -03:00

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_process::prebuilt as view_process;

fn main() {
    examples_util::print_info();
    // view_process::run_same_process(app_main);

    view_process::init();
    app_main();
}

fn app_main() {
    APP.defaults().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.