Skip to content

Commit

Permalink
Improve resizing in dx11 example (ocornut#3057)
Browse files Browse the repository at this point in the history
Make the dx11 example implementation resize the window in a sane way, i.e. not the stretching/scaling the initial render to fit the new window size (current behaviour).
  • Loading branch information
joeslay authored and sergeyn committed Mar 30, 2020
1 parent 7423b55 commit cc03b40
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/example_sdl_directx11/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ int main(int, char**)
done = true;
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
done = true;
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED)
{
g_pd3dDeviceContext->OMSetRenderTargets(0, 0, 0);
// Release all outstanding references to the swap chain's buffers.
g_mainRenderTargetView->Release();

g_pSwapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
CreateRenderTarget();
}
}

// Start the Dear ImGui frame
Expand Down

0 comments on commit cc03b40

Please sign in to comment.