2020-08-21 16:53:43 +00:00
|
|
|
/// Demonstrates how to make an app using Egui.
|
|
|
|
///
|
2020-12-29 13:15:46 +00:00
|
|
|
/// Implements `epi::App` so it can be used with
|
2020-08-21 16:53:43 +00:00
|
|
|
/// [`egui_glium`](https://crates.io/crates/egui_glium) and [`egui_web`](https://crates.io/crates/egui_web).
|
2021-01-01 16:11:05 +00:00
|
|
|
#[derive(Default, serde::Deserialize, serde::Serialize)]
|
|
|
|
#[serde(default)]
|
2020-07-23 10:01:48 +00:00
|
|
|
pub struct DemoApp {
|
2021-01-01 16:11:05 +00:00
|
|
|
demo_windows: super::DemoWindows,
|
2020-07-23 16:54:16 +00:00
|
|
|
}
|
|
|
|
|
2020-12-29 13:15:46 +00:00
|
|
|
impl epi::App for DemoApp {
|
2020-12-18 21:30:59 +00:00
|
|
|
fn name(&self) -> &str {
|
2021-01-01 23:13:34 +00:00
|
|
|
"✨ Egui Demo"
|
2020-12-18 21:30:59 +00:00
|
|
|
}
|
|
|
|
|
2020-12-29 13:15:46 +00:00
|
|
|
fn load(&mut self, storage: &dyn epi::Storage) {
|
|
|
|
*self = epi::get_value(storage, epi::APP_KEY).unwrap_or_default()
|
2020-12-19 19:50:00 +00:00
|
|
|
}
|
|
|
|
|
2020-12-29 13:15:46 +00:00
|
|
|
fn save(&mut self, storage: &mut dyn epi::Storage) {
|
|
|
|
epi::set_value(storage, epi::APP_KEY, self);
|
2020-12-19 19:50:00 +00:00
|
|
|
}
|
|
|
|
|
2021-01-02 00:01:01 +00:00
|
|
|
fn update(&mut self, ctx: &egui::CtxRef, _frame: &mut epi::Frame<'_>) {
|
|
|
|
self.demo_windows.ui(ctx);
|
2020-07-23 16:54:16 +00:00
|
|
|
}
|
2020-05-10 17:04:10 +00:00
|
|
|
}
|