eframe 0.16.0

egui framework - write GUI apps that compiles to web and/or natively

eframe - the egui framework crate

If you are planning to write an app for web or native, and are happy with just using egui for all visuals, Then eframe is for you!

To get started, look at https://github.com/emilk/eframe_template.

You write your application code for [epi] (implementing [epi::App]) and then call from [crate::run_native] your main.rs, and/or call eframe::start_web from your lib.rs.

eframe is implemented using egui_web for web and egui_glium or egui_glow for native.

Usage, native:

use eframe::{epi, egui};

struct MyEguiApp {}

impl epi::App for MyEguiApp {
fn name(&self) -> &str {
"My egui App"

fn update(&mut self, ctx: &egui::CtxRef, frame: &epi::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("Hello World!");

fn main() {
let app = MyEguiApp::default();
let native_options = eframe::NativeOptions::default();
eframe::run_native(Box::new(app), native_options);

Usage, web:

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;

/// Call this once from the HTML.
#[cfg(target_arch = "wasm32")]
pub fn start(canvas_id: &str) -> Result<(), eframe::wasm_bindgen::JsValue> {
let app = MyEguiApp::default();
eframe::start_web(canvas_id, Box::new(app))