From 5a3f82e2f4f30e529f765d38aaa76866653b245a Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 31 Jan 2023 15:49:54 +0100 Subject: [PATCH] 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). --- docs/CHANGELOG.txt | 2 ++ examples/example_sdl_sdlrenderer/main.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 31f1fee6..4a84eb02 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -64,6 +64,8 @@ All changes: - Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted 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). ----------------------------------------------------------------------- diff --git a/examples/example_sdl_sdlrenderer/main.cpp b/examples/example_sdl_sdlrenderer/main.cpp index 736e7c6f..2ba7ec23 100644 --- a/examples/example_sdl_sdlrenderer/main.cpp +++ b/examples/example_sdl_sdlrenderer/main.cpp @@ -143,6 +143,7 @@ int main(int, char**) // Rendering 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_RenderClear(renderer); ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());