Bladeren bron

Fixed performance issue on windows by moving game rendering into WM_PAINT.

Steve Grenier 14 jaren geleden
bovenliggende
commit
38811de13b
1 gewijzigde bestanden met toevoegingen van 5 en 6 verwijderingen
  1. 5 6
      gameplay/src/PlatformWin32.cpp

+ 5 - 6
gameplay/src/PlatformWin32.cpp

@@ -252,6 +252,11 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
     switch (msg)
     {
+    case WM_PAINT:
+        gameplay::Game::getInstance()->frame();
+        SwapBuffers(__hdc);
+        return 0;
+
     case WM_CLOSE:
         DestroyWindow(__hwnd);
         return 0;
@@ -517,12 +522,6 @@ int Platform::enterMessagePump()
             }
         }
 
-        if (_game->getState() != Game::PAUSED)
-        {
-            _game->frame();
-            SwapBuffers(__hdc);
-        }
-
         // If we are done, then exit.
         if (_game->getState() == Game::UNINITIALIZED)
             break;