M 027
M 027

Reputation: 307

Continuing run even when sending WM_PAINT in Direct3D 11

I'm developing a game by Win32 and Direct3D 11, but when I move or resize the window (WM_PAINT event), the game pauses run:

GIF to explain my problem

So, how can I keep the game runs even when I move or resize the window?

This the code in game loop:

while (msg.message != WM_QUIT) {  
  if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    TranslateMessage(&msg), DispatchMessageW(&msg);
     
  // code of the game (renderering and mechanics)
}

And this the WndProc():

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
  if (message == WM_CLOSE) {
    DestroyWindow(hwnd), PostQuitMessage(0);
    return 0;
  }
  return DefWindowProcW(hwnd, message, wParam, lParam);
}

I looked this question, but it talks about Direct2D (and I want Direct3D 11).

Upvotes: 3

Views: 116

Answers (0)

Related Questions