diff --git a/client/src/app.c b/client/src/app.c index a3cae879..c6be9845 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -70,7 +70,7 @@ void app_updateCursorPos(double x, double y) g_cursor.valid = true; if (g_state.overlayInput) - g_state.io->MousePos = (ImVec2) { x * g_state.windowScale, y * g_state.windowScale }; + g_state.io->MousePos = (ImVec2) { x, y }; } void app_handleFocusEvent(bool focused) @@ -723,6 +723,14 @@ int app_renderOverlay(struct Rect * rects, int maxRects) const int written = overlay->ops->render(overlay->udata, false, buffer, MAX_OVERLAY_RECTS); + for (int i = 0; i < written; ++i) + { + buffer[i].x *= g_state.windowScale; + buffer[i].y *= g_state.windowScale; + buffer[i].w *= g_state.windowScale; + buffer[i].h *= g_state.windowScale; + } + // It is an error to run out of rectangles, because we will not be able to // correctly calculate the damage of the next frame. assert(written >= 0); diff --git a/client/src/main.c b/client/src/main.c index c30c7abe..f39623e4 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -181,12 +181,14 @@ static int renderThread(void * unused) if (resize) { g_state.io->DisplaySize = (ImVec2) { - .x = g_state.windowW * g_state.windowScale, - .y = g_state.windowH * g_state.windowScale + .x = g_state.windowW, + .y = g_state.windowH, }; - - imGuiResetStyle(); - ImGuiStyle_ScaleAllSizes(g_state.style, g_state.windowScale); + g_state.io->DisplayFramebufferScale = (ImVec2) { + .x = g_state.windowScale, + .y = g_state.windowScale, + }; + g_state.io->FontGlobalScale = 1.0f / g_state.windowScale; ImFontAtlas_Clear(g_state.io->Fonts); ImFontAtlas_AddFontFromFileTTF(g_state.io->Fonts, g_state.fontName,