1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00
Files
egui/crates/egui_demo_app/src/lib.rs
Lucas Meurer 2e26b70ae9 Call logic even while browser tab is in background (#8257)
* Closes https://github.com/emilk/egui/issues/5112

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 14:59:45 +02:00

39 lines
1.0 KiB
Rust

//! Demo app for egui
mod apps;
mod backend_panel;
mod frame_history;
mod wrap_app;
pub use wrap_app::{Anchor, WrapApp};
/// Time of day as seconds since midnight. Used for clock in demo app.
pub(crate) fn seconds_since_midnight() -> f64 {
jiff::Zoned::now()
.time()
.duration_since(jiff::civil::Time::midnight())
.as_secs_f64()
}
/// Trait that wraps different parts of the demo app.
pub trait DemoApp {
fn demo_ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame);
/// Run background logic, called every frame even when the app is hidden.
///
/// See [`eframe::App::logic`].
fn logic(&mut self, _ctx: &egui::Context) {}
#[cfg(feature = "glow")]
fn on_exit(&mut self, _gl: Option<&eframe::glow::Context>) {}
}
// ----------------------------------------------------------------------------
#[cfg(feature = "accessibility_inspector")]
pub mod accessibility_inspector;
#[cfg(target_arch = "wasm32")]
mod web;
#[cfg(target_arch = "wasm32")]
pub use web::*;