Changeset 81869ef in opengl-game for sdl-game.cpp


Ignore:
Timestamp:
Feb 14, 2021, 4:08:47 PM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
8d96e95
Parents:
484334e
Message:

Avoid rendering frames while the window is minimized

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sdl-game.cpp

    r484334e r81869ef  
    209209
    210210      ImGui::Render();
    211       ImDrawData* draw_data = ImGui::GetDrawData();
    212       const bool is_minimized = (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f);
    213       if (!is_minimized) {
    214          renderFrame(draw_data);
     211
     212      gui->refreshWindowSize();
     213
     214      const bool isMinimized = gui->getWindowWidth() <= 0 || gui->getWindowHeight() <= 0;
     215
     216      if (!isMinimized) {
     217         renderFrame(ImGui::GetDrawData());
    215218         presentFrame();
    216219      }
Note: See TracChangeset for help on using the changeset viewer.