wgpu + egui 0.20.0

android broken but let's just fix it on the egui/winit side once that's
all updated
This commit is contained in:
William Casarin
2022-12-10 16:57:46 -08:00
parent 3f64dedf76
commit b6f5d8dc03
8 changed files with 610 additions and 973 deletions

View File

@@ -2,6 +2,11 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
use damus::Damus;
use eframe;
use log::info;
// Entry point for wasm
//#[cfg(target_arch = "wasm32")]
//use wasm_bindgen::prelude::*;
// Desktop
#[cfg(not(target_arch = "wasm32"))]
@@ -17,20 +22,22 @@ fn main() {
);
}
// Web
#[cfg(target_arch = "wasm32")]
fn main() {
pub fn main() {
// Make sure panics are logged using `console.error`.
console_error_panic_hook::set_once();
// Redirect tracing to console.log and friends:
tracing_wasm::set_as_global_default();
let web_options = eframe::WebOptions::default();
eframe::start_web(
"the_canvas_id", // hardcode it
web_options,
Box::new(|_cc| Box::new(Damus::new())),
)
.expect("failed to start eframe");
wasm_bindgen_futures::spawn_local(async {
let web_options = eframe::WebOptions::default();
eframe::start_web(
"the_canvas_id", // hardcode it
web_options,
Box::new(|_cc| Box::new(Damus::new())),
)
.await
.expect("failed to start eframe");
});
}