-
Notifications
You must be signed in to change notification settings - Fork 55
/
egui_basic.rs
38 lines (31 loc) · 974 Bytes
/
egui_basic.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
use notan::egui::{self, *};
use notan::prelude::*;
#[notan_main]
fn main() -> Result<(), String> {
let win = WindowConfig::new()
.set_vsync(true)
.set_lazy_loop(true)
.set_high_dpi(true);
notan::init()
.add_config(win)
.add_config(EguiConfig)
.draw(draw)
.build()
}
fn draw(app: &mut App, gfx: &mut Graphics, plugins: &mut Plugins) {
let mut output = plugins.egui(|ctx| {
egui::SidePanel::left("side_panel").show(ctx, |ui| {
ui.heading("Egui Plugin Example");
ui.separator();
if ui.button("Quit").clicked() {
app.exit();
}
ui.separator();
ui.label("Welcome to a basic example of how to use Egui with notan.");
ui.separator();
ui.label("Check the source code to learn more about how it works");
});
});
output.clear_color(Color::BLACK);
gfx.render(&output);
}