Calling the full App::update when the application is hidden (background thread or minimized on native, for instance) is bad for several reasons:
A) we don't always know what the size of the viewport is/should be
B) we pay the cost of GUI even though we may only need to process some events
I think therefor it makes sense to split App::update into two functions:
trait App {
/// You can run logic here, but can't show any GUI.
///
/// Called once before each call to [`Self::show`], but may also be called
/// without a subsequent call to `show`,
/// for instance if the application is hidden and [`Context::request_repaint`] has been called.
///
/// The egui context may ONLY be used to schedule repaints, nothing else.
fn logic(&mut self, ctx: &egui::Context, frame: &mut Frame) {
}
/// Show the GUI. Each call to this is preceded by a call to [`Self::tick`].
fn ui(&mut self, ui: &mut egui::Ui, frame: &mut Frame);
}
Ideally we should do this without too much of a breaking change though
Calling the full
App::updatewhen the application is hidden (background thread or minimized on native, for instance) is bad for several reasons:A) we don't always know what the size of the viewport is/should be
B) we pay the cost of GUI even though we may only need to process some events
I think therefor it makes sense to split
App::updateinto two functions:Ideally we should do this without too much of a breaking change though