forked from imgui-rs/imgui-rs
-
Notifications
You must be signed in to change notification settings - Fork 4
/
hello_docking.rs
45 lines (42 loc) · 1.47 KB
/
hello_docking.rs
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use imgui::*;
mod support;
fn main() {
let mut system = support::init(file!());
system.imgui.io_mut().config_flags |= imgui::ConfigFlags::DOCKING_ENABLE;
let mut first_time = true;
system.main_loop(move |_, ui| {
Window::new(im_str!("Hello")).build(ui, || {
ui.text(im_str!("Hello"));
});
Window::new(im_str!("Docking")).build(ui, || {
ui.text(im_str!("Docking"));
});
Window::new(im_str!("Awesome")).build(ui, || {
ui.text(im_str!("Awesome"));
});
if first_time {
first_time = false;
imgui::Dock::new().build(|root| {
root.size([512_f32, 512_f32])
.position([0_f32, 0_f32])
.split(
imgui::Direction::Left,
0.7_f32,
|left| {
left.dock_window(im_str!("Hello"));
},
|right| {
right.split(imgui::Direction::Up, 0.5_f32,
|top| {
top.dock_window(im_str!("Docking"));
},
|bottom| {
bottom.dock_window(im_str!("Awesome"));
}
);
},
)
});
}
});
}