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

epi: merge App::load into App::setup, and provide Frame argument

This gives users more control over the order of load/setup.

It also allows users to load textures in setup.
This commit is contained in:
Emil Ernerfeldt
2021-06-07 20:53:33 +02:00
parent 31769d400f
commit 44b573f6a6
7 changed files with 105 additions and 53 deletions

View File

@@ -15,8 +15,15 @@ impl epi::App for DemoApp {
}
#[cfg(feature = "persistence")]
fn load(&mut self, storage: &dyn epi::Storage) {
*self = epi::get_value(storage, epi::APP_KEY).unwrap_or_default()
fn setup(
&mut self,
_ctx: &egui::CtxRef,
_frame: &mut epi::Frame<'_>,
storage: Option<&dyn epi::Storage>,
) {
if let Some(storage) = storage {
*self = epi::get_value(storage, epi::APP_KEY).unwrap_or_default()
}
}
#[cfg(feature = "persistence")]