Correctly handling pixel format and fullscreen resolution on Win32

This commit is contained in:
Tomaka17 2014-08-02 12:23:05 +02:00
parent b0d9d0b87f
commit 0152099c91
2 changed files with 49 additions and 6 deletions

View file

@ -193,6 +193,26 @@ pub static FORMAT_MESSAGE_IGNORE_INSERTS: DWORD = 0x00000200;
// ?
pub static PFD_TYPE_RGBA: BYTE = 0;
pub static PFD_TYPE_COLORINDEX: BYTE = 1;
pub static PFD_MAIN_PLANE: BYTE = 0;
pub static PFD_OVERLAY_PLANE: BYTE = 1;
pub static PFD_UNDERLAY_PLANE: BYTE = (-1);
pub static PFD_DOUBLEBUFFER: DWORD = 0x00000001;
pub static PFD_STEREO: DWORD = 0x00000002;
pub static PFD_DRAW_TO_WINDOW: DWORD = 0x00000004;
pub static PFD_DRAW_TO_BITMAP: DWORD = 0x00000008;
pub static PFD_SUPPORT_GDI: DWORD = 0x00000010;
pub static PFD_SUPPORT_OPENGL: DWORD = 0x00000020;
pub static PFD_GENERIC_FORMAT: DWORD = 0x00000040;
pub static PFD_NEED_PALETTE: DWORD = 0x00000080;
pub static PFD_NEED_SYSTEM_PALETTE: DWORD = 0x00000100;
pub static PFD_SWAP_EXCHANGE: DWORD = 0x00000200;
pub static PFD_SWAP_COPY: DWORD = 0x00000400;
pub static PFD_SWAP_LAYER_BUFFERS: DWORD = 0x00000800;
pub static PFD_GENERIC_ACCELERATED: DWORD = 0x00001000;
pub static PFD_SUPPORT_COMPOSITION: DWORD = 0x00008000;
pub static PFD_DEPTH_DONTCARE: DWORD = 0x20000000;
pub static PFD_DOUBLEBUFFER_DONTCARE: DWORD = 0x40000000;
pub static PFD_STEREO_DONTCARE: DWORD = 0x80000000;
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx
pub static SW_FORCEMINIMIZE: libc::c_int = 11;
@ -638,6 +658,9 @@ extern "system" {
pub fn ChangeDisplaySettingsExW(lpszDeviceName: LPCWSTR, lpDevMode: *mut DEVMODE, hwnd: HWND,
dwFlags: DWORD, lParam: LPVOID) -> LONG;
// http://msdn.microsoft.com/en-us/library/dd318284(v=vs.85).aspx
pub fn ChoosePixelFormat(hdc: HDC, ppfd: *const PIXELFORMATDESCRIPTOR) -> libc::c_int;
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680(v=vs.85).aspx
pub fn CreateWindowExW(dwExStyle: DWORD, lpClassName: LPCWSTR, lpWindowName: LPCWSTR,
dwStyle: DWORD, x: libc::c_int, y: libc::c_int, nWidth: libc::c_int, nHeight: libc::c_int,