Improve resizing in dx11 example (#3057)

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).
This commit is contained in:
joeslay 2020-03-11 17:51:02 +00:00 committed by ocornut
parent a5041c8820
commit a0f01d2290

View File

@ -101,6 +101,15 @@ int main(int, char**)
done = true; done = true;
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
done = true; 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 // Start the Dear ImGui frame