Changeset 484334e in opengl-game


Ignore:
Timestamp:
Feb 14, 2021, 3:50:35 PM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
81869ef
Parents:
7734042
git-author:
Dmitry Portnoy <dportnoy@…> (02/14/21 15:48:29)
git-committer:
Dmitry Portnoy <dportnoy@…> (02/14/21 15:50:35)
Message:

In VulkanGame, correctly recreate the swap chain during the render loop, and in SDLGame, use the GameGui class to get the window dimensions during swap chain recreation

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sdl-game.cpp

    r7734042 r484334e  
    169169
    170170      if (shouldRecreateSwapChain) {
    171          int width, height;
    172          SDL_GetWindowSize(window, &width, &height);
     171         gui->refreshWindowSize();
     172
     173         int width = gui->getWindowWidth();
     174         int height = gui->getWindowHeight();
    173175         if (width > 0 && height > 0) {
    174176            // TODO: This should be used if the min image count changes, presumably because a new surface was created
  • vulkan-game.cpp

    r7734042 r484334e  
    936936      }
    937937
     938      if (shouldRecreateSwapChain) {
     939         gui->refreshWindowSize();
     940
     941         int width = gui->getWindowWidth();
     942         int height = gui->getWindowHeight();
     943         if (width > 0 && height > 0) {
     944            // TODO: This should be used if the min image count changes, presumably because a new surface was created
     945            // with a different image count or something like that. Maybe I want to add code to query for a new min image count
     946            // during swapchain recreation to take advantage of this
     947            ImGui_ImplVulkan_SetMinImageCount(swapChainMinImageCount);
     948
     949            recreateSwapChain();
     950
     951            imageIndex = 0;
     952            shouldRecreateSwapChain = false;
     953         }
     954      }
     955
    938956      currentScreen->renderUI();
    939957
Note: See TracChangeset for help on using the changeset viewer.