zng/examples
Samuel Guerra a19b90490f Started implementing zoom-to scale. 2023-09-09 20:42:37 -03:00
..
res Added Arabic localization test. 2023-07-29 18:40:43 -03:00
util Rust 1.72 lint fixes and build test update. 2023-08-24 14:03:07 -03:00
Cargo.toml Started implementing example of view extension for custom rendering. 2023-06-06 22:30:04 -03:00
README.md More refactor. 2023-04-12 15:42:03 -03:00
animation.rs Renamed `txt_color` to `font_color` to align the name with `font_palette`. 2023-06-23 01:13:29 -03:00
border.rs Fixed border_align and fill corner radius. 2023-08-18 15:26:37 -03:00
button.rs Refactored touch events to support better coordination between conflicting touch gestures. 2023-08-29 12:59:34 -03:00
calculator.rs More key refactor. 2023-08-04 18:20:22 -03:00
config.rs Renamed `txt_color` to `font_color` to align the name with `font_palette`. 2023-06-23 01:13:29 -03:00
countdown.rs More refactor. 2023-04-12 18:02:22 -03:00
cursor.rs Renamed `txt_color` to `font_color` to align the name with `font_palette`. 2023-06-23 01:13:29 -03:00
extend_view.rs Fixed texture example UV. 2023-08-25 18:59:23 -03:00
focus.rs More key refactor. 2023-08-04 18:20:22 -03:00
gradient.rs Refacotored gradient nodes into nicer builder types. 2023-06-28 18:33:17 -03:00
headless.rs Finished implementing image mask in view crate. 2023-08-07 11:22:18 -03:00
icon.rs Started implementing overflow detection. 2023-08-18 18:59:57 -03:00
image.rs Added scroll zoom commands. 2023-09-08 17:08:43 -03:00
layer.rs Implemented filtered context capture and better layer size anchoring. 2023-07-14 17:20:53 -03:00
localize.rs Added Arabic localization test. 2023-07-29 18:40:43 -03:00
markdown.rs More property refactor to organize docs. 2023-04-18 13:18:38 -03:00
respawn.rs Refactored `WINDOW_CTRL` into `WINDOW_Ext` trait. 2023-06-21 17:22:44 -03:00
scroll.rs Started implementing zoom-to scale. 2023-09-09 20:42:37 -03:00
shortcuts.rs More key refactor. 2023-08-04 18:20:22 -03:00
text.rs More overflow work. 2023-08-22 00:19:50 -03:00
transform.rs Improved transform hovered animations. 2023-09-06 16:55:55 -03:00
window.rs More TOUCH_TRANSFORM_EVENT review, resolved to use the center as hit-test (like it is now), the other option was the first touch hit-test, but the normal usage is to capture the pointer anyway so we cover more use cases. 2023-09-03 23:51:16 -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_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.