From 28f809ef80fccfbc44e8912f6c1df762626e54dd Mon Sep 17 00:00:00 2001 From: maik klein Date: Mon, 26 Dec 2016 02:35:43 +0100 Subject: [PATCH] Add winapi to do another cast --- examples/Cargo.lock | 1 + examples/Cargo.toml | 1 + examples/src/lib.rs | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/Cargo.lock b/examples/Cargo.lock index c7028d7..c8c2f9e 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -5,6 +5,7 @@ dependencies = [ "ash 0.2.0", "image 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winit 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 210e911..59430c2 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -10,3 +10,4 @@ ash = { version = "*", path = "../"} [target.'cfg(windows)'.dependencies] user32-sys = "0.2.0" +winapi = "0.2.8" diff --git a/examples/src/lib.rs b/examples/src/lib.rs index c12e4af..b23d952 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -4,6 +4,8 @@ extern crate ash; extern crate winit; #[cfg(windows)] extern crate user32; +#[cfg(windows)] +extern crate winapi; use ash::vk; use std::default::Default; @@ -101,14 +103,14 @@ fn create_surface(instance: &Instance, window: &winit::Window) -> Result { use winit::os::windows::WindowExt; - let hwnd = window.get_hwnd() as *const (); + let hwnd = window.get_hwnd() as *mut winapi::windef::HWND__; let hinstance = user32::GetWindow(hwnd, 0) as *const (); let win32_create_info = vk::Win32SurfaceCreateInfoKHR { s_type: vk::StructureType::Win32SurfaceCreateInfoKhr, p_next: ptr::null(), flags: Default::default(), hinstance: hinstance, - hwnd: hwnd, + hwnd: hwnd as *const (), }; let win32_surface_loader = Win32Surface::new(&entry, &instance) .expect("Unable to load win32 surface");