mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Use CreateWindowExW instead of A
This commit is contained in:
parent
58565b9812
commit
b05fb33fb3
|
@ -9,7 +9,6 @@ use Scale;
|
||||||
use Vsync;
|
use Vsync;
|
||||||
use Key;
|
use Key;
|
||||||
|
|
||||||
use std::ffi::CString;
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::os::windows::ffi::OsStrExt;
|
use std::os::windows::ffi::OsStrExt;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
|
@ -204,7 +203,6 @@ impl Window {
|
||||||
fn open_window(name: &str, width: usize, height: usize, _: Scale, _: Vsync) -> Option<HWND> {
|
fn open_window(name: &str, width: usize, height: usize, _: Scale, _: Vsync) -> Option<HWND> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let class_name = to_wstring("minifb_window");
|
let class_name = to_wstring("minifb_window");
|
||||||
let s = CString::new(name).unwrap();
|
|
||||||
|
|
||||||
let class = WNDCLASSW {
|
let class = WNDCLASSW {
|
||||||
style: winapi::CS_HREDRAW | winapi::CS_VREDRAW | winapi::CS_OWNDC,
|
style: winapi::CS_HREDRAW | winapi::CS_VREDRAW | winapi::CS_OWNDC,
|
||||||
|
@ -238,9 +236,9 @@ impl Window {
|
||||||
rect.right -= rect.left;
|
rect.right -= rect.left;
|
||||||
rect.bottom -= rect.top;
|
rect.bottom -= rect.top;
|
||||||
|
|
||||||
let handle = user32::CreateWindowExA(0,
|
let handle = user32::CreateWindowExW(0,
|
||||||
"minifb_window".as_ptr() as *mut _,
|
class_name,
|
||||||
s.as_ptr(),
|
to_wstring(name),
|
||||||
winapi::WS_OVERLAPPEDWINDOW &
|
winapi::WS_OVERLAPPEDWINDOW &
|
||||||
!winapi::WS_MAXIMIZEBOX &
|
!winapi::WS_MAXIMIZEBOX &
|
||||||
!winapi::WS_THICKFRAME,
|
!winapi::WS_THICKFRAME,
|
||||||
|
@ -253,7 +251,7 @@ impl Window {
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
ptr::null_mut());
|
ptr::null_mut());
|
||||||
if handle.is_null() {
|
if handle.is_null() {
|
||||||
println!("Unable to register create window, error {}", kernel32::GetLastError() as u32);
|
println!("Unable to create window, error {}", kernel32::GetLastError() as u32);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue