Exemple #1
0
void App::OnWindowResized(void* context, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    if(msg != WM_SIZE)
        return;

    App* app = reinterpret_cast<App*>(context);

    if(!app->swapChain.FullScreen() && wParam != SIZE_MINIMIZED)
    {
        int width, height;
        app->window.GetClientArea(width, height);

        if(uint32(width) != app->swapChain.Width() || uint32(height) != app->swapChain.Height())
        {
            app->DestroyPSOs_Internal();

            app->BeforeReset_Internal();

            app->swapChain.SetWidth(width);
            app->swapChain.SetHeight(height);
            app->swapChain.Reset();

            app->AfterReset_Internal();

            app->CreatePSOs_Internal();
        }
    }
}