changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / rust/ui/alik/src/main.rs

changeset 698: 96958d3eb5b0
parent: 957915316dea
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 // When compiling natively:
2 #[cfg(not(target_arch = "wasm32"))]
3 fn main() -> eframe::Result<()> {
4  // env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
5 
6  let mut native_options = eframe::NativeOptions {
7  viewport: egui::ViewportBuilder::default()
8  .with_inner_size([400.0, 300.0])
9  .with_min_inner_size([300.0, 220.0])
10  .with_taskbar(true)
11  .with_decorations(true),
12  // .with_icon(
13  // // NOTE: Adding an icon is optional
14  // eframe::icon_data::from_png_bytes(&include_bytes!("../assets/icon-256.
15  // png")[..]) .expect("Failed to load icon"),
16  ..Default::default()
17  };
18  native_options.default_theme = eframe::Theme::Dark;
19  eframe::run_native(
20  "alik",
21  native_options,
22  Box::new(|cc| Box::new(alik_ui::AlikApp::new(cc))),
23  )
24 }
25 
26 // When compiling to web using trunk:
27 #[cfg(target_arch = "wasm32")]
28 fn main() {
29  // Redirect `log` message to `console.log` and friends:
30  eframe::WebLogger::init(log::LevelFilter::Debug).ok();
31 
32  let web_options = eframe::WebOptions::default();
33 
34  wasm_bindgen_futures::spawn_local(async {
35  eframe::WebRunner::new()
36  .start(
37  "app_canvas", // hardcode it
38  web_options,
39  Box::new(|cc| Box::new(alik_ui::AlikApp::new(cc))),
40  )
41  .await
42  .expect("failed to start eframe");
43  });
44 }