Skip to main content

example/
example.rs

1// examples/hello.rs
2// cargo run --example hello
3
4use cosg::*;
5
6fn main() {
7    let app = App::new(
8        AppConfig {
9            title:  "CosG — Hello".into(),
10            width:  640,
11            height: 480,
12            theme:  Theme::violet_dark(),
13        },
14        || {
15            let btn = Button::new()
16                .label("Kliknij mnie")
17                .esc(Esc::new().border_radius(12.0).opacity(1.0))
18                .on_press(|| println!("pressed!"));
19
20            let lbl = Label::new("CosG UI");
21
22            Box::new(
23                Container::new()
24                    .padding(24.0)
25                    .esc(Esc::new().border_radius(0.0))
26                    .add(lbl)
27                    .add(btn),
28            )
29        },
30    );
31
32    app.run();
33}