todoodoo/src/main.rs

35 lines
1,014 B
Rust
Raw Normal View History

2024-01-04 16:36:41 +01:00
use eframe::egui;
fn main() {
std::env::set_var("WINIT_UNIX_BACKEND", "wayland");
let native_options = eframe::NativeOptions::default();
if let Err(err) = eframe::run_native(
"My egui App",
native_options,
Box::new(|cc| Box::new(MyEguiApp::new(cc))),
) {
eprintln!("{err}");
}
}
#[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!");
});
}
}