mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Wrap tesselated output in struct ClippedMesh(Rect, Mesh)
This commit is contained in:
@@ -168,7 +168,7 @@ The same code can be compiled to a native app or a web app.
|
||||
|
||||
### Writing your own egui integration
|
||||
|
||||
You need to collect [`egui::RawInput`](https://docs.rs/egui/latest/egui/struct.RawInput.html), paint [`egui::PaintJobs`](https://docs.rs/egui/latest/egui/paint/tessellator/type.PaintJobs.html) and handle [`egui::Output`](https://docs.rs/egui/latest/egui/struct.Output.html). The basic structure is this:
|
||||
You need to collect [`egui::RawInput`](https://docs.rs/egui/latest/egui/struct.RawInput.html), paint [`egui::ClippedMesh`](https://docs.rs/epaint/):es and handle [`egui::Output`](https://docs.rs/egui/latest/egui/struct.Output.html). The basic structure is this:
|
||||
|
||||
``` rust
|
||||
let mut egui_ctx = egui::Context::new();
|
||||
@@ -179,8 +179,8 @@ loop {
|
||||
egui_ctx.begin_frame(raw_input);
|
||||
my_app.ui(&mut egui_ctx); // add panels, windows and widgets to `egui_ctx` here
|
||||
let (output, shapes) = egui_ctx.end_frame();
|
||||
let paint_jobs = egui_ctx.tessellate(shapes); // create triangles to paint
|
||||
my_integration.paint(paint_jobs);
|
||||
let clipped_meshes = egui_ctx.tessellate(shapes); // create triangles to paint
|
||||
my_integration.paint(clipped_meshes);
|
||||
my_integration.set_cursor_icon(output.cursor_icon);
|
||||
// Also see `egui::Output` for more
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user