1
0
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:
Emil Ernerfeldt
2021-01-25 21:43:17 +01:00
parent 75fa77e040
commit b493bc6efc
16 changed files with 89 additions and 71 deletions

View File

@@ -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
}