Prepare for release

This commit is contained in:
Piotr Siuszko 2025-10-04 22:00:11 +02:00
parent 9bd24849f4
commit 6e2820b500
3 changed files with 25 additions and 0 deletions

View File

@ -112,5 +112,6 @@ fn atlas_loaded(
Bevy version | Crate version
--- | ---
0.17 | 0.3
0.16 | 0.2
0.15 | 0.1

View File

@ -56,6 +56,11 @@ web-sys = { version = "0.3", features = [
] }
js-sys = "0.3"
[build-dependencies]
winresource = "0.1.19"
image = { version = "0.25", features = ["png"] }
ico = "0.4.0"
[package.metadata.bundle]
name = "Rpack"
icon = ["static/base_icon.png"]

View File

@ -18,4 +18,23 @@ fn main() {
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_DATE={}", git_hash);
}
if std::env::var("CARGO_CFG_TARGET_OS").is_ok_and(|t| t.eq("windows")) {
let icon = image::open("./static/base_icon.png").expect("Failed to open icon");
let new_icon = icon.resize(128, 128, image::imageops::FilterType::Lanczos3);
new_icon
.save("../../target/icon_128.png")
.expect("Failed to save");
let mut icon_dir = ico::IconDir::new(ico::ResourceType::Icon);
let gen_image_file =
std::fs::File::open("../../target/icon_128.png").expect("failed to open icon file");
let gen_image =
ico::IconImage::read_png(gen_image_file).expect("failed to read icon image");
icon_dir.add_entry(ico::IconDirEntry::encode(&gen_image).unwrap());
let file = std::fs::File::create("../../target/icon.ico").unwrap();
icon_dir.write(file).expect("Failed to write icon");
let mut res = winresource::WindowsResource::new();
res.set_icon("../../target/icon.ico");
let _ = res.compile();
}
}