Egui core library
To get started with Egui, you can use one of the available integrations
such as egui_web
or egui_glium
.
Whatever you use, you need an egui::Context
(by convention referred to by ctx
).
With it you can then get access to an Ui
where you can put widgets.
Use one of SidePanel
, TopPanel
, CentralPanel
, Window
or Area
. For instace:
# let mut ctx = egui::Context::new();
# ctx.begin_frame(Default::default());
egui::CentralPanel::default().show(&ctx, |ui| {
ui.label("Hello");
});
To write your own integration for Egui you need to do this:
let mut egui_ctx = egui::Context::new();
// Game loop:
loop {
let raw_input: egui::RawInput = my_integration.gather_input();
egui_ctx.begin_frame(raw_input);
my_app.ui(&egui_ctx); // add panels, windows and widgets to `egui_ctx` here
let (output, paint_commands) = egui_ctx.end_frame();
let paint_jobs = self.ctx.tesselate(paint_commands); // create triangles to paint
my_integration.paint(paint_jobs);
my_integration.set_cursor_icon(output.cursor_icon);
// Also see `egui::Output` for more
}