diff --git a/Cargo.lock b/Cargo.lock index 90b4d94ea..526dd5edf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -516,6 +516,15 @@ name = "either" version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "embed-resource" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "vswhom 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "encode_unicode" version = "0.3.6" @@ -1848,6 +1857,7 @@ name = "ruffle_desktop" version = "0.1.0" dependencies = [ "cpal 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "embed-resource 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "generational-arena 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.23.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2352,6 +2362,24 @@ name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "vswhom-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "walkdir" version = "2.3.1" @@ -2662,6 +2690,14 @@ dependencies = [ "x11-dl 2.18.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winreg" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wio" version = "0.2.2" @@ -2779,6 +2815,7 @@ dependencies = [ "checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" "checksum downcast-rs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6" "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +"checksum embed-resource 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1f6b0b4403da80c2fd32333937dd468292c001d778c587ae759b75432772715d" "checksum encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" "checksum enumset 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3691ce759534316ad900d57dd8e688e2c4263f9750c0f7c1e9b9a4516d4ca241" "checksum enumset_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74bef436ac71820c5cf768d7af9ba33121246b09a00e09a55d94ef8095a875ac" @@ -2972,6 +3009,8 @@ dependencies = [ "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum vswhom 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +"checksum vswhom-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc2f5402d3d0e79a069714f7b48e3ecc60be7775a2c049cb839457457a239532" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" "checksum wasm-bindgen 0.2.63 (registry+https://github.com/rust-lang/crates.io-index)" = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" @@ -3002,6 +3041,7 @@ dependencies = [ "checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum winit 0.22.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ccbf7ddb6627828eace16cacde80fc6bf4dbb3469f88487262a02cf8e7862" +"checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" "checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x11 2.18.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773" diff --git a/desktop/Cargo.toml b/desktop/Cargo.toml index c208f897f..9b7c20c88 100644 --- a/desktop/Cargo.toml +++ b/desktop/Cargo.toml @@ -22,6 +22,9 @@ winit = "0.22" webbrowser = "0.5.2" url = "2.1.1" +[target.'cfg(windows)'.build-dependencies] +embed-resource = "1" + [features] avm_debug = ["ruffle_core/avm_debug"] render_debug_labels = ["ruffle_render_wgpu/render_debug_labels"] diff --git a/desktop/assets/favicon-32.rgba b/desktop/assets/favicon-32.rgba new file mode 100644 index 000000000..8c78a441b Binary files /dev/null and b/desktop/assets/favicon-32.rgba differ diff --git a/desktop/assets/favicon.ico b/desktop/assets/favicon.ico new file mode 100644 index 000000000..140e0f20a Binary files /dev/null and b/desktop/assets/favicon.ico differ diff --git a/desktop/assets/ruffle_desktop.rc b/desktop/assets/ruffle_desktop.rc new file mode 100644 index 000000000..1cd7ae584 --- /dev/null +++ b/desktop/assets/ruffle_desktop.rc @@ -0,0 +1,3 @@ +#define IDI_ICON 0x101 + +IDI_ICON ICON "assets/favicon.ico" \ No newline at end of file diff --git a/desktop/build.rs b/desktop/build.rs new file mode 100644 index 000000000..f8a526c45 --- /dev/null +++ b/desktop/build.rs @@ -0,0 +1,7 @@ +#[cfg(windows)] +fn main() { + embed_resource::compile("assets/ruffle_desktop.rc") +} + +#[cfg(not(windows))] +fn main() {} \ No newline at end of file diff --git a/desktop/src/main.rs b/desktop/src/main.rs index a87386366..9d98850d9 100644 --- a/desktop/src/main.rs +++ b/desktop/src/main.rs @@ -24,7 +24,7 @@ use std::rc::Rc; use winit::dpi::{LogicalSize, PhysicalPosition}; use winit::event::{ElementState, MouseButton, WindowEvent}; use winit::event_loop::{ControlFlow, EventLoop}; -use winit::window::WindowBuilder; +use winit::window::{WindowBuilder, Icon}; #[derive(StructOpt, Debug)] #[structopt(name = "basic")] @@ -50,6 +50,9 @@ fn run_player(input_path: PathBuf) -> Result<(), Box> { let movie = SwfMovie::from_path(&input_path)?; let movie_size = LogicalSize::new(movie.width(), movie.height()); + let icon_bytes = include_bytes!("../assets/favicon-32.rgba"); + let icon = Icon::from_rgba(icon_bytes.to_vec(), 32, 32)?; + let event_loop: EventLoop = EventLoop::with_user_event(); let window = Rc::new( WindowBuilder::new() @@ -57,6 +60,7 @@ fn run_player(input_path: PathBuf) -> Result<(), Box> { "Ruffle - {}", input_path.file_name().unwrap_or_default().to_string_lossy() )) + .with_window_icon(Some(icon)) .with_inner_size(movie_size) .build(&event_loop)?, );