Add winapi to do another cast
This commit is contained in:
parent
150e32a7c6
commit
28f809ef80
1
examples/Cargo.lock
generated
1
examples/Cargo.lock
generated
|
@ -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)",
|
||||
]
|
||||
|
||||
|
|
|
@ -10,3 +10,4 @@ ash = { version = "*", path = "../"}
|
|||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
user32-sys = "0.2.0"
|
||||
winapi = "0.2.8"
|
||||
|
|
|
@ -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<vk::SurfaceKHR, vk::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");
|
||||
|
|
Loading…
Reference in a new issue