Examples: SDL+SDL_Renderer: Added call to SDL_RenderSetScale() to display is correct on a Retina display (albeit lower-res as our other unmodified examples). (#6121, #6065, #5931).

This commit is contained in:
ocornut 2023-01-31 15:49:54 +01:00
parent 867bdbecb3
commit 5a3f82e2f4
2 changed files with 3 additions and 0 deletions

View File

@ -64,6 +64,8 @@ All changes:
- Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call - Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call
DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted
when application is compiled without /DUNICODE. (#5725, #5961, #5975) [@markreidvfx] when application is compiled without /DUNICODE. (#5725, #5961, #5975) [@markreidvfx]
- Examples: SDL+SDL_Renderer: Added call to SDL_RenderSetScale() to display is correct on a
Retina display (albeit lower-res as our other unmodified examples). (#6121, #6065, #5931).
----------------------------------------------------------------------- -----------------------------------------------------------------------

View File

@ -143,6 +143,7 @@ int main(int, char**)
// Rendering // Rendering
ImGui::Render(); ImGui::Render();
SDL_RenderSetScale(renderer, io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
SDL_SetRenderDrawColor(renderer, (Uint8)(clear_color.x * 255), (Uint8)(clear_color.y * 255), (Uint8)(clear_color.z * 255), (Uint8)(clear_color.w * 255)); SDL_SetRenderDrawColor(renderer, (Uint8)(clear_color.x * 255), (Uint8)(clear_color.y * 255), (Uint8)(clear_color.z * 255), (Uint8)(clear_color.w * 255));
SDL_RenderClear(renderer); SDL_RenderClear(renderer);
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData()); ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());