Mercurial > mm7
comparison OSWindow.cpp @ 2076:0d535449c04f
Слияние
author | Ritor1 |
---|---|
date | Wed, 04 Dec 2013 15:40:38 +0600 |
parents | 259df09dfb50 |
children | 9574c5bfb96f |
comparison
equal
deleted
inserted
replaced
2075:24033aa2e1f8 | 2076:0d535449c04f |
---|---|
270 if ( wparam && (GetForegroundWindow() == api_handle || GetForegroundWindow() == hInsertCDWindow) ) | 270 if ( wparam && (GetForegroundWindow() == api_handle || GetForegroundWindow() == hInsertCDWindow) ) |
271 { | 271 { |
272 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) | 272 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) |
273 { | 273 { |
274 dword_4E98BC_bApplicationActive = 1; | 274 dword_4E98BC_bApplicationActive = 1; |
275 if ( pRenderer->bWindowMode ) | 275 /*if ( pRenderer->bWindowMode ) |
276 { | 276 { |
277 HDC hDC = GetDC(api_handle); | 277 HDC hDC = GetDC(api_handle); |
278 int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL); | 278 int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL); |
279 int planes = GetDeviceCaps(hDC, PLANES); | 279 int planes = GetDeviceCaps(hDC, PLANES); |
280 ReleaseDC(api_handle, hDC); | 280 ReleaseDC(api_handle, hDC); |
281 if (bitsPerPixel != 16 || planes != 1) | 281 if (bitsPerPixel != 16 || planes != 1) |
282 Error(pGlobalTXT_LocalizationStrings[62]); | 282 Error(L"%S", pGlobalTXT_LocalizationStrings[62]); |
283 } | 283 }*/ |
284 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_APP_INACTIVE; | 284 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_APP_INACTIVE; |
285 | 285 |
286 if ( pArcomageGame->bGameInProgress ) | 286 if ( pArcomageGame->bGameInProgress ) |
287 { | 287 { |
288 pArcomageGame->field_F9 = 1; | 288 pArcomageGame->field_F9 = 1; |
400 wcxw.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; | 400 wcxw.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; |
401 if (!RegisterClassExW(&wcxw)) | 401 if (!RegisterClassExW(&wcxw)) |
402 return false; | 402 return false; |
403 | 403 |
404 api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, 0, | 404 api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, 0, |
405 0, 0, window_width, window_height, nullptr, | 405 ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_width) / 2), |
406 ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_height) / 2), | |
407 window_width, window_height, nullptr, | |
406 nullptr, wcxw.hInstance, this); | 408 nullptr, wcxw.hInstance, this); |
407 if (!api_handle) | 409 if (!api_handle) |
408 { | 410 { |
409 UnregisterClassW(wcxw.lpszClassName, wcxw.hInstance); | 411 UnregisterClassW(wcxw.lpszClassName, wcxw.hInstance); |
410 return false; | 412 return false; |
497 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, SWP_NOSIZE | SWP_SHOWWINDOW); | 499 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, SWP_NOSIZE | SWP_SHOWWINDOW); |
498 } | 500 } |
499 | 501 |
500 void OSWindow::SetWindowedMode(int new_window_width, int new_window_height) | 502 void OSWindow::SetWindowedMode(int new_window_width, int new_window_height) |
501 { | 503 { |
504 RECT rcWindowPos; | |
505 GetWindowRect(api_handle, &rcWindowPos); | |
506 | |
502 SetWindowLongW(api_handle, GWL_EXSTYLE, 0); | 507 SetWindowLongW(api_handle, GWL_EXSTYLE, 0); |
503 SetWindowLongW(api_handle, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW); | 508 SetWindowLongW(api_handle, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW); |
504 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, 0); | 509 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, 0); |
505 | 510 |
506 RECT rcWindow; | 511 RECT rcWindow; |
516 | 521 |
517 #ifdef _DEBUG | 522 #ifdef _DEBUG |
518 if (!GetMenu(api_handle)) | 523 if (!GetMenu(api_handle)) |
519 window_total_height += GetSystemMetrics(SM_CYMENU); | 524 window_total_height += GetSystemMetrics(SM_CYMENU); |
520 #endif | 525 #endif |
521 MoveWindow(api_handle, ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_total_width) / 2), | 526 MoveWindow(api_handle, rcWindowPos.left, |
522 ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_total_height) / 2), | 527 rcWindowPos.top, |
523 window_total_width, | 528 window_total_width, |
524 window_total_height, 0); | 529 window_total_height, 0); |
525 #ifdef _DEBUG | 530 #ifdef _DEBUG |
526 static HMENU debug_menu = CreateDebugMenuPanel(); | 531 static HMENU debug_menu = CreateDebugMenuPanel(); |
527 SetMenu(api_handle, debug_menu); | 532 SetMenu(api_handle, debug_menu); |
533 | |
534 GetWindowRect(api_handle, &rcWindow); | |
535 GetClientRect(api_handle, &rcClient); | |
528 #endif | 536 #endif |
529 } | 537 } |
530 | 538 |
531 | 539 |
532 | 540 |