diff --git a/examples/Cargo.toml b/examples/Cargo.toml index fd51f40..3ad5c47 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -4,10 +4,9 @@ version = "0.1.0" authors = ["maik klein "] [dependencies] -winit = "0.9.0" +winit = "0.11.1" image = "0.10.4" ash = { path = "../ash" } [target.'cfg(windows)'.dependencies] -user32-sys = "0.2.0" -winapi = "0.2.8" +winapi = { version = "0.3.4", features = ["windef", "winuser"] } diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 8e48443..55c4862 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -1,9 +1,6 @@ -#![allow(dead_code)] #[macro_use] extern crate ash; #[cfg(windows)] -extern crate user32; -#[cfg(windows)] extern crate winapi; extern crate winit; @@ -118,9 +115,12 @@ unsafe fn create_surface( instance: &I, window: &winit::Window, ) -> Result { + use winapi::shared::windef::HWND; + use winapi::um::winuser::GetWindow; use winit::os::windows::WindowExt; - let hwnd = window.get_hwnd() as *mut winapi::windef::HWND__; - let hinstance = unsafe { user32::GetWindow(hwnd, 0) as *const vk::c_void }; + + let hwnd = window.get_hwnd() as HWND; + let hinstance = GetWindow(hwnd, 0) as *const vk::c_void; let win32_create_info = vk::Win32SurfaceCreateInfoKHR { s_type: vk::StructureType::Win32SurfaceCreateInfoKhr, p_next: ptr::null(), @@ -165,7 +165,6 @@ unsafe extern "system" fn vulkan_debug_callback( 1 } - pub fn find_memorytype_index( memory_req: &vk::MemoryRequirements, memory_prop: &vk::PhysicalDeviceMemoryProperties, @@ -203,10 +202,6 @@ pub fn find_memorytype_index_f, pub instance: Instance, @@ -264,13 +259,13 @@ impl ExampleBase { } }); } + pub fn new(window_width: u32, window_height: u32) -> Self { unsafe { let events_loop = winit::EventsLoop::new(); let window = winit::WindowBuilder::new() .with_title("Ash - Example") .with_dimensions(window_width, window_height) - //.with_window_resize_callback(resize_callback) .build(&events_loop) .unwrap(); let entry = Entry::new().unwrap();