1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Replace Context::begin_frame/end_frame with fn run taking a closure (#872)

* Replace Context begin_frame/end_frame with `fn run` taking a closure
* Create `egui::__run_test_ui` to replace `Ui::__test`
* Add helper `egui::__run_test_ctx` for doctests
This commit is contained in:
Emil Ernerfeldt
2021-11-03 20:11:25 +01:00
committed by GitHub
parent e54106e950
commit 49e43885ff
32 changed files with 294 additions and 199 deletions

View File

@@ -282,8 +282,6 @@ impl EpiIntegration {
let raw_input = self.egui_winit.take_egui_input(window);
self.egui_ctx.begin_frame(raw_input);
let mut app_output = epi::backend::AppOutput::default();
let mut frame = epi::backend::FrameBuilder {
info: integration_info(self.integration_name, window, self.latest_frame_time),
@@ -293,9 +291,11 @@ impl EpiIntegration {
}
.build();
self.app.update(&self.egui_ctx, &mut frame);
let app = &mut self.app; // TODO: remove when we update MSVR to 1.56
let (egui_output, shapes) = self.egui_ctx.run(raw_input, |egui_ctx| {
app.update(egui_ctx, &mut frame);
});
let (egui_output, shapes) = self.egui_ctx.end_frame();
let needs_repaint = egui_output.needs_repaint;
self.egui_winit
.handle_output(window, &self.egui_ctx, egui_output);