Egui demo app
- Taken from the documentation
examples/egui/egui-app/src/main.rs
use eframe::egui; fn main() { let native_options = eframe::NativeOptions::default(); eframe::run_native( "My egui App", native_options, Box::new(|cc| Box::new(MyEguiApp::new(cc))), ) .unwrap(); } #[derive(Default)] struct MyEguiApp {} impl MyEguiApp { fn new(_cc: &eframe::CreationContext<'_>) -> Self { // Customize egui here with cc.egui_ctx.set_fonts and cc.egui_ctx.set_visuals. // Restore app state using cc.storage (requires the "persistence" feature). // Use the cc.gl (a glow::Context) to create graphics shaders and buffers that you can use // for e.g. egui::PaintCallback. Self::default() } } impl eframe::App for MyEguiApp { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { egui::CentralPanel::default().show(ctx, |ui| { ui.heading("Hello World!"); }); } }