Skip to content

Commit

Permalink
[GUI] Add exe icon on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
widberg committed Jan 13, 2024
1 parent 8d4a668 commit 94629c4
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
21 changes: 20 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions bff-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions bff-gui/build.rs
Original file line number Diff line number Diff line change
@@ -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(())
}
Binary file added bff-gui/resources/bff.ico
Binary file not shown.
8 changes: 6 additions & 2 deletions bff-gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 94629c4

Please sign in to comment.