comparison OSWindow.cpp @ 2139:f9b55be70c1b

Слияние
author Ritor1
date Thu, 02 Jan 2014 09:11:28 +0600
parents 49de109bbab5
children ca548138d6aa
comparison
equal deleted inserted replaced
2138:7cc14d9d966d 2139:f9b55be70c1b
65 { 65 {
66 case WM_KEYUP: 66 case WM_KEYUP:
67 { 67 {
68 if (wparam == VK_CONTROL) 68 if (wparam == VK_CONTROL)
69 _507B98_ctrl_pressed = false; 69 _507B98_ctrl_pressed = false;
70 if (wparam == VK_SNAPSHOT)
71 pRenderer->SavePCXScreenshot();
70 72
71 OnKey(wparam); 73 OnKey(wparam);
72 return *result = 0, true; 74 return *result = 0, true;
73 } 75 }
74 76
270 if ( wparam && (GetForegroundWindow() == api_handle || GetForegroundWindow() == hInsertCDWindow) ) 272 if ( wparam && (GetForegroundWindow() == api_handle || GetForegroundWindow() == hInsertCDWindow) )
271 { 273 {
272 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) 274 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
273 { 275 {
274 dword_4E98BC_bApplicationActive = 1; 276 dword_4E98BC_bApplicationActive = 1;
275 if ( pRenderer->bWindowMode ) 277 /*if ( pRenderer->bWindowMode )
276 { 278 {
277 HDC hDC = GetDC(api_handle); 279 HDC hDC = GetDC(api_handle);
278 int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL); 280 int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL);
279 int planes = GetDeviceCaps(hDC, PLANES); 281 int planes = GetDeviceCaps(hDC, PLANES);
280 ReleaseDC(api_handle, hDC); 282 ReleaseDC(api_handle, hDC);
281 if (bitsPerPixel != 16 || planes != 1) 283 if (bitsPerPixel != 16 || planes != 1)
282 Error(pGlobalTXT_LocalizationStrings[62]); 284 Error(L"%S", pGlobalTXT_LocalizationStrings[62]);
283 } 285 }*/
284 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_APP_INACTIVE; 286 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_APP_INACTIVE;
285 287
286 if ( pArcomageGame->bGameInProgress ) 288 if ( pArcomageGame->bGameInProgress )
287 { 289 {
288 pArcomageGame->field_F9 = 1; 290 pArcomageGame->field_F9 = 1;
329 if ( pMiscTimer->bPaused ) 331 if ( pMiscTimer->bPaused )
330 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0400_MISC_TIMER; 332 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0400_MISC_TIMER;
331 else 333 else
332 pMiscTimer->Pause(); 334 pMiscTimer->Pause();
333 335
334 pAudioPlayer->StopChannels(-1, -1); 336 pAudioPlayer->StopChannels(-1, -1);//
335 if ( pAudioPlayer->hAILRedbook ) 337 if ( pAudioPlayer->hAILRedbook )
336 AIL_redbook_pause(pAudioPlayer->hAILRedbook); 338 AIL_redbook_pause(pAudioPlayer->hAILRedbook);
337 } 339 }
338 } 340 }
339 return *result = 0, true; 341 return *result = 0, true;
400 wcxw.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; 402 wcxw.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
401 if (!RegisterClassExW(&wcxw)) 403 if (!RegisterClassExW(&wcxw))
402 return false; 404 return false;
403 405
404 api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, 0, 406 api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, 0,
405 0, 0, window_width, window_height, nullptr, 407 ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_width) / 2),
408 ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_height) / 2),
409 window_width, window_height, nullptr,
406 nullptr, wcxw.hInstance, this); 410 nullptr, wcxw.hInstance, this);
407 if (!api_handle) 411 if (!api_handle)
408 { 412 {
409 UnregisterClassW(wcxw.lpszClassName, wcxw.hInstance); 413 UnregisterClassW(wcxw.lpszClassName, wcxw.hInstance);
410 return false; 414 return false;
497 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, SWP_NOSIZE | SWP_SHOWWINDOW); 501 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, SWP_NOSIZE | SWP_SHOWWINDOW);
498 } 502 }
499 503
500 void OSWindow::SetWindowedMode(int new_window_width, int new_window_height) 504 void OSWindow::SetWindowedMode(int new_window_width, int new_window_height)
501 { 505 {
506 RECT rcWindowPos;
507 GetWindowRect(api_handle, &rcWindowPos);
508
502 SetWindowLongW(api_handle, GWL_EXSTYLE, 0); 509 SetWindowLongW(api_handle, GWL_EXSTYLE, 0);
503 SetWindowLongW(api_handle, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW); 510 SetWindowLongW(api_handle, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW);
504 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, 0); 511 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, 0);
505 512
506 RECT rcWindow; 513 RECT rcWindow;
516 523
517 #ifdef _DEBUG 524 #ifdef _DEBUG
518 if (!GetMenu(api_handle)) 525 if (!GetMenu(api_handle))
519 window_total_height += GetSystemMetrics(SM_CYMENU); 526 window_total_height += GetSystemMetrics(SM_CYMENU);
520 #endif 527 #endif
521 MoveWindow(api_handle, ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_total_width) / 2), 528 MoveWindow(api_handle, rcWindowPos.left,
522 ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_total_height) / 2), 529 rcWindowPos.top,
523 window_total_width, 530 window_total_width,
524 window_total_height, 0); 531 window_total_height, 0);
525 #ifdef _DEBUG 532 #ifdef _DEBUG
526 static HMENU debug_menu = CreateDebugMenuPanel(); 533 static HMENU debug_menu = CreateDebugMenuPanel();
527 SetMenu(api_handle, debug_menu); 534 SetMenu(api_handle, debug_menu);
535
536 GetWindowRect(api_handle, &rcWindow);
537 GetClientRect(api_handle, &rcClient);
528 #endif 538 #endif
529 } 539 }
530 540
531 541
532 542
683 switch (item_id) 693 switch (item_id)
684 { 694 {
685 default: return false; 695 default: return false;
686 696
687 697
688 case 103: pRenderer->SavePCXScreenshot(); break; 698 //case 103: pRenderer->SavePCXScreenshot(); break;
689 case 101: // Quit game 699 case 101: // Quit game
690 case 40001: 700 case 40001: // Menu "File"-> "Exit"
691 pGame->Deinitialize(); 701 pGame->Deinitialize();
692 SendMessageW(api_handle, WM_DESTROY, 0, 0); 702 SendMessageW(api_handle, WM_DESTROY, 0, 0);
693 break; 703 break;
694 704
695 case 104: 705 case 104: //F4 button
696 pRenderer->ChangeBetweenWinFullscreenModes(); 706 pRenderer->ChangeBetweenWinFullscreenModes();
697 if (pArcomageGame->bGameInProgress) 707 if (pArcomageGame->bGameInProgress)
698 pArcomageGame->field_F6 = 1; 708 pArcomageGame->field_F6 = 1;
699 break; 709 break;
700 710