From 6c21bc52eb84e3979b14f9da741bed0087e193f2 Mon Sep 17 00:00:00 2001 From: CptFisk Date: Mon, 24 Apr 2023 21:31:05 +0200 Subject: [PATCH] Update imgui_impl_sdl3.cpp Fixed issue when using SDL_SetRenderScale() --- backends/imgui_impl_sdl3.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backends/imgui_impl_sdl3.cpp b/backends/imgui_impl_sdl3.cpp index 5b0c82d95..c6ffe72f8 100644 --- a/backends/imgui_impl_sdl3.cpp +++ b/backends/imgui_impl_sdl3.cpp @@ -237,6 +237,9 @@ bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event) case SDL_EVENT_MOUSE_MOTION: { ImVec2 mouse_pos((float)event->motion.x, (float)event->motion.y); + SDL_GetRenderScale(bd->Renderer, &scaleX, &scaleY); + mouse_pos.x *= scaleX; + mouse_pos.y *= scaleY; io.AddMouseSourceEvent(event->motion.which == SDL_TOUCH_MOUSEID ? ImGuiMouseSource_TouchScreen : ImGuiMouseSource_Mouse); io.AddMousePosEvent(mouse_pos.x, mouse_pos.y); return true;