Merge pull request #49 from LPGhatguy/update-examples
Update examples to winapi 0.3 and winit 0.11; clean up dead code
This commit is contained in:
commit
16cebe2e3e
2 changed files with 8 additions and 14 deletions
|
@ -4,10 +4,9 @@ version = "0.1.0"
|
||||||
authors = ["maik klein <maikklein@googlemail.com>"]
|
authors = ["maik klein <maikklein@googlemail.com>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
winit = "0.9.0"
|
winit = "0.11.1"
|
||||||
image = "0.10.4"
|
image = "0.10.4"
|
||||||
ash = { path = "../ash" }
|
ash = { path = "../ash" }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
user32-sys = "0.2.0"
|
winapi = { version = "0.3.4", features = ["windef", "winuser"] }
|
||||||
winapi = "0.2.8"
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#![allow(dead_code)]
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate ash;
|
extern crate ash;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
extern crate user32;
|
|
||||||
#[cfg(windows)]
|
|
||||||
extern crate winapi;
|
extern crate winapi;
|
||||||
extern crate winit;
|
extern crate winit;
|
||||||
|
|
||||||
|
@ -118,9 +115,12 @@ unsafe fn create_surface<E: EntryV1_0, I: InstanceV1_0>(
|
||||||
instance: &I,
|
instance: &I,
|
||||||
window: &winit::Window,
|
window: &winit::Window,
|
||||||
) -> Result<vk::SurfaceKHR, vk::Result> {
|
) -> Result<vk::SurfaceKHR, vk::Result> {
|
||||||
|
use winapi::shared::windef::HWND;
|
||||||
|
use winapi::um::winuser::GetWindow;
|
||||||
use winit::os::windows::WindowExt;
|
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 {
|
let win32_create_info = vk::Win32SurfaceCreateInfoKHR {
|
||||||
s_type: vk::StructureType::Win32SurfaceCreateInfoKhr,
|
s_type: vk::StructureType::Win32SurfaceCreateInfoKhr,
|
||||||
p_next: ptr::null(),
|
p_next: ptr::null(),
|
||||||
|
@ -165,7 +165,6 @@ unsafe extern "system" fn vulkan_debug_callback(
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn find_memorytype_index(
|
pub fn find_memorytype_index(
|
||||||
memory_req: &vk::MemoryRequirements,
|
memory_req: &vk::MemoryRequirements,
|
||||||
memory_prop: &vk::PhysicalDeviceMemoryProperties,
|
memory_prop: &vk::PhysicalDeviceMemoryProperties,
|
||||||
|
@ -203,10 +202,6 @@ pub fn find_memorytype_index_f<F: Fn(vk::MemoryPropertyFlags, vk::MemoryProperty
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resize_callback(width: u32, height: u32) {
|
|
||||||
println!("Window resized to {}x{}", width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ExampleBase {
|
pub struct ExampleBase {
|
||||||
pub entry: Entry<V1_0>,
|
pub entry: Entry<V1_0>,
|
||||||
pub instance: Instance<V1_0>,
|
pub instance: Instance<V1_0>,
|
||||||
|
@ -264,13 +259,13 @@ impl ExampleBase {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window_width: u32, window_height: u32) -> Self {
|
pub fn new(window_width: u32, window_height: u32) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
let events_loop = winit::EventsLoop::new();
|
let events_loop = winit::EventsLoop::new();
|
||||||
let window = winit::WindowBuilder::new()
|
let window = winit::WindowBuilder::new()
|
||||||
.with_title("Ash - Example")
|
.with_title("Ash - Example")
|
||||||
.with_dimensions(window_width, window_height)
|
.with_dimensions(window_width, window_height)
|
||||||
//.with_window_resize_callback(resize_callback)
|
|
||||||
.build(&events_loop)
|
.build(&events_loop)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let entry = Entry::new().unwrap();
|
let entry = Entry::new().unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue