Mercurial > mm7
diff OSWindow.cpp @ 2069:259df09dfb50
32bits almost there
author | Nomad |
---|---|
date | Tue, 03 Dec 2013 20:18:17 +0200 |
parents | b2a434d65344 |
children | 9574c5bfb96f |
line wrap: on
line diff
--- a/OSWindow.cpp Mon Dec 02 15:13:49 2013 +0200 +++ b/OSWindow.cpp Tue Dec 03 20:18:17 2013 +0200 @@ -272,15 +272,15 @@ if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) { dword_4E98BC_bApplicationActive = 1; - if ( pRenderer->bWindowMode ) + /*if ( pRenderer->bWindowMode ) { HDC hDC = GetDC(api_handle); int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL); int planes = GetDeviceCaps(hDC, PLANES); ReleaseDC(api_handle, hDC); if (bitsPerPixel != 16 || planes != 1) - Error(pGlobalTXT_LocalizationStrings[62]); - } + Error(L"%S", pGlobalTXT_LocalizationStrings[62]); + }*/ dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_APP_INACTIVE; if ( pArcomageGame->bGameInProgress ) @@ -402,7 +402,9 @@ return false; api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, 0, - 0, 0, window_width, window_height, nullptr, + ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_width) / 2), + ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_height) / 2), + window_width, window_height, nullptr, nullptr, wcxw.hInstance, this); if (!api_handle) { @@ -499,6 +501,9 @@ void OSWindow::SetWindowedMode(int new_window_width, int new_window_height) { + RECT rcWindowPos; + GetWindowRect(api_handle, &rcWindowPos); + SetWindowLongW(api_handle, GWL_EXSTYLE, 0); SetWindowLongW(api_handle, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW); SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, 0); @@ -518,13 +523,16 @@ if (!GetMenu(api_handle)) window_total_height += GetSystemMetrics(SM_CYMENU); #endif - MoveWindow(api_handle, ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_total_width) / 2), - ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_total_height) / 2), + MoveWindow(api_handle, rcWindowPos.left, + rcWindowPos.top, window_total_width, window_total_height, 0); #ifdef _DEBUG static HMENU debug_menu = CreateDebugMenuPanel(); SetMenu(api_handle, debug_menu); + + GetWindowRect(api_handle, &rcWindow); + GetClientRect(api_handle, &rcClient); #endif }