mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Combine demo_glium and demo_web into one egui_demo crate
This commit is contained in:
18
egui_demo/src/lib.rs
Normal file
18
egui_demo/src/lib.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
#![forbid(unsafe_code)]
|
||||
#![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds
|
||||
#![warn(clippy::all)]
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
/// This is the entry-point for all the web-assembly.
|
||||
/// This is called once from the HTML.
|
||||
/// It loads the app, installs some callbacks, then returns.
|
||||
/// You can add more callbacks like this if you want to call in to your code.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
#[wasm_bindgen]
|
||||
pub fn start(canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> {
|
||||
let app = egui::DemoApp::default();
|
||||
egui_web::start(canvas_id, Box::new(app))?;
|
||||
Ok(())
|
||||
}
|
||||
9
egui_demo/src/main.rs
Normal file
9
egui_demo/src/main.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
#![forbid(unsafe_code)]
|
||||
#![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds
|
||||
#![warn(clippy::all)]
|
||||
|
||||
// When compiling natively:
|
||||
fn main() {
|
||||
let app = egui::DemoApp::default();
|
||||
egui_glium::run(Box::new(app));
|
||||
}
|
||||
Reference in New Issue
Block a user