Rename epi::App::ui to epi::App::update

This commit is contained in:
Emil Ernerfeldt 2021-01-01 20:22:18 +01:00
parent defad4ed51
commit b1022d01c1
6 changed files with 8 additions and 8 deletions

View file

@ -293,7 +293,7 @@ impl epi::App for DemoApp {
epi::set_value(storage, epi::APP_KEY, self);
}
fn ui(&mut self, ctx: &CtxRef, frame: &mut epi::Frame<'_>) {
fn update(&mut self, ctx: &CtxRef, frame: &mut epi::Frame<'_>) {
self.frame_history
.on_new_frame(ctx.input().time, frame.info().cpu_usage);

View file

@ -62,7 +62,7 @@ impl epi::App for HttpApp {
/// Called each time the UI needs repainting, which may be many times per second.
/// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`.
fn ui(&mut self, ctx: &egui::CtxRef, frame: &mut epi::Frame<'_>) {
fn update(&mut self, ctx: &egui::CtxRef, frame: &mut epi::Frame<'_>) {
if let Some(receiver) = &mut self.in_progress {
// Are we there yet?
if let Ok(result) = receiver.try_recv() {

View file

@ -21,7 +21,7 @@ impl epi::App for WrapApp {
epi::set_value(storage, epi::APP_KEY, self);
}
fn ui(&mut self, ctx: &egui::CtxRef, frame: &mut epi::Frame<'_>) {
fn update(&mut self, ctx: &egui::CtxRef, frame: &mut epi::Frame<'_>) {
let web_location_hash = frame
.info()
.web_info
@ -57,9 +57,9 @@ impl epi::App for WrapApp {
});
if self.selectable_demo_name == self.demo.name() {
self.demo.ui(ctx, frame);
self.demo.update(ctx, frame);
} else if self.selectable_demo_name == self.http.name() {
self.http.ui(ctx, frame);
self.http.update(ctx, frame);
} else {
self.selectable_demo_name = self.demo.name().to_owned();
}

View file

@ -150,7 +150,7 @@ pub fn run(mut app: Box<dyn epi::App>) -> ! {
repaint_signal: repaint_signal.clone(),
}
.build();
app.ui(&ctx, &mut frame);
app.update(&ctx, &mut frame);
let (egui_output, paint_commands) = ctx.end_frame();
let paint_jobs = ctx.tessellate(paint_commands);

View file

@ -203,7 +203,7 @@ impl AppRunner {
.build();
let egui_ctx = &self.web_backend.ctx;
self.app.ui(egui_ctx, &mut frame);
self.app.update(egui_ctx, &mut frame);
let (egui_output, paint_jobs) = self.web_backend.end_frame()?;
handle_output(&egui_output);

View file

@ -60,7 +60,7 @@ pub use egui; // Re-export for user convenience
pub trait App {
/// Called each time the UI needs repainting, which may be many times per second.
/// Put your widgets into a [`egui::SidePanel`], [`egui::TopPanel`], [`egui::CentralPanel`], [`egui::Window`] or [`egui::Area`].
fn ui(&mut self, ctx: &egui::CtxRef, frame: &mut Frame<'_>);
fn update(&mut self, ctx: &egui::CtxRef, frame: &mut Frame<'_>);
/// Called once before the first frame.
/// Allows you to do setup code and to call `ctx.set_fonts()`.