get it working on all platforms again
This commit is contained in:
@@ -1,8 +1,36 @@
|
||||
use damus::WinitEvent;
|
||||
#![warn(clippy::all, rust_2018_idioms)]
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
use damus::Damus;
|
||||
use eframe;
|
||||
|
||||
// Desktop
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn main() {
|
||||
#[cfg(debug_assertions)]
|
||||
simple_logger::init().unwrap();
|
||||
let event_loop = winit::event_loop::EventLoopBuilder::<WinitEvent>::with_user_event().build();
|
||||
damus::main(event_loop);
|
||||
// Log to stdout (if you run with `RUST_LOG=debug`).
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let native_options = eframe::NativeOptions::default();
|
||||
eframe::run_native(
|
||||
"Damus Desktop",
|
||||
native_options,
|
||||
Box::new(|cc| Box::new(Damus::new())),
|
||||
);
|
||||
}
|
||||
|
||||
// Web
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user