1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use kurbo::Point;
use viewbuilder::{ui::Window, Object, UserInterface};
use viewbuilder_macros::object;

struct Example;

#[object]
impl Object for Example {
    #[slot]
    fn set_cursor_pos(&mut self, point: Point) {
        dbg!(point);
    }
}

fn main() {
    let mut app = UserInterface::new();
    let _guard = app.enter();

    let window = Window {}.spawn();
    let example = Example.spawn();
    window.cursor_pos().bind(&example, Example::set_cursor_pos);
    app.insert_window(window);

    app.run();
}