diff --git a/Cargo.lock b/Cargo.lock index aeaa7b7..5a0fea5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -683,6 +683,7 @@ dependencies = [ "three-d-asset", "tokio", "wasm-bindgen-futures", + "winres", ] [[package]] @@ -3615,7 +3616,7 @@ dependencies = [ "cfg-expr", "heck", "pkg-config", - "toml", + "toml 0.8.4", "version-compare", ] @@ -3766,6 +3767,15 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml" version = "0.8.4" @@ -4506,6 +4516,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml 0.5.11", +] + [[package]] name = "x11-dl" version = "2.21.0" diff --git a/bff-gui/Cargo.toml b/bff-gui/Cargo.toml index 4d5997f..e594efd 100644 --- a/bff-gui/Cargo.toml +++ b/bff-gui/Cargo.toml @@ -38,5 +38,8 @@ three-d = { version = "0.16.1", default-features = false, features = [ eframe = { version = "0.23.0", features = ["persistence"] } async-std = "1.12.0" +[target.'cfg(target_os = "windows")'.build-dependencies] +winres = "0.1.12" + [lints] workspace = true diff --git a/bff-gui/build.rs b/bff-gui/build.rs new file mode 100644 index 0000000..a445059 --- /dev/null +++ b/bff-gui/build.rs @@ -0,0 +1,13 @@ +use std::io::Error; + +fn main() -> Result<(), Error> { + if cfg!(target_os = "windows") { + let mut res = winres::WindowsResource::new(); + res.set_icon("resources/bff.ico"); + res.compile()?; + println!("cargo:rerun-if-changed=resources/bff.ico"); + } + println!("cargo:rerun-if-changed=build.rs"); + + Ok(()) +} diff --git a/bff-gui/resources/bff.ico b/bff-gui/resources/bff.ico new file mode 100644 index 0000000..e3675ba Binary files /dev/null and b/bff-gui/resources/bff.ico differ diff --git a/bff-gui/src/main.rs b/bff-gui/src/main.rs index 18245f5..4a2ef2c 100644 --- a/bff-gui/src/main.rs +++ b/bff-gui/src/main.rs @@ -45,7 +45,11 @@ fn main() -> Result<(), eframe::Error> { initial_window_size: Some(WINDOW_SIZE), ..Default::default() }; - eframe::run_native(TITLE, options, Box::new(|cc| Box::new(Gui::new(cc, env::args().collect())))) + eframe::run_native( + TITLE, + options, + Box::new(|cc| Box::new(Gui::new(cc, env::args().collect()))), + ) } #[cfg(target_arch = "wasm32")] @@ -115,7 +119,7 @@ impl Gui { let p = PathBuf::from(path); load_bf(cc.egui_ctx.clone(), p.clone(), tx.clone()); true - }, + } None => false, }; Self {