diff OSWindow.cpp @ 2139:f9b55be70c1b

Слияние
author Ritor1
date Thu, 02 Jan 2014 09:11:28 +0600
parents 49de109bbab5
children ca548138d6aa
line wrap: on
line diff
--- a/OSWindow.cpp	Thu Jan 02 09:11:01 2014 +0600
+++ b/OSWindow.cpp	Thu Jan 02 09:11:28 2014 +0600
@@ -67,6 +67,8 @@
     {
       if (wparam == VK_CONTROL)
         _507B98_ctrl_pressed = false;
+      if (wparam == VK_SNAPSHOT)
+        pRenderer->SavePCXScreenshot();
 
       OnKey(wparam);
       return *result = 0, true;
@@ -272,15 +274,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 )
@@ -331,7 +333,7 @@
           else
             pMiscTimer->Pause();
 
-          pAudioPlayer->StopChannels(-1, -1);
+          pAudioPlayer->StopChannels(-1, -1);//      
           if ( pAudioPlayer->hAILRedbook )
             AIL_redbook_pause(pAudioPlayer->hAILRedbook);
         }
@@ -402,7 +404,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 +503,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 +525,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
 }
 
@@ -685,14 +695,14 @@
     default: return false;
 
 
-    case 103:  pRenderer->SavePCXScreenshot(); break;
+    //case 103:  pRenderer->SavePCXScreenshot(); break;
     case 101:  // Quit game
-    case 40001:
-		pGame->Deinitialize();
+    case 40001: // Menu "File"-> "Exit"
+      pGame->Deinitialize();
       SendMessageW(api_handle, WM_DESTROY, 0, 0);
     break;
 
-    case 104:
+    case 104: //F4 button
       pRenderer->ChangeBetweenWinFullscreenModes();
       if (pArcomageGame->bGameInProgress)
         pArcomageGame->field_F6 = 1;