diff --git a/src/overlay.cpp b/src/overlay.cpp index ae3e9897..68d676f9 100644 --- a/src/overlay.cpp +++ b/src/overlay.cpp @@ -13,6 +13,7 @@ struct benchmark_stats benchmark; struct fps_limit fps_limit_stats {}; +ImVec2 real_font_size; void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID) { diff --git a/src/overlay.h b/src/overlay.h index 91e30abc..471f36e1 100644 --- a/src/overlay.h +++ b/src/overlay.h @@ -79,6 +79,7 @@ extern struct fps_limit fps_limit_stats; extern int32_t deviceID; extern struct benchmark_stats benchmark; +extern ImVec2 real_font_size; void position_layer(struct swapchain_stats& data, struct overlay_params& params, ImVec2 window_size); void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2& window_size, bool is_vulkan); diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp index b1967580..1fe5346c 100644 --- a/src/overlay_params.cpp +++ b/src/overlay_params.cpp @@ -616,5 +616,6 @@ parse_overlay_config(struct overlay_params *params, #endif if(!params->output_file.empty()) printf("MANGOHUD: output_file is Deprecated, use output_folder instead\n"); - + auto real_size = params->font_size * params->font_scale; + real_font_size = ImVec2(real_size, real_size / 2); } diff --git a/src/vulkan.cpp b/src/vulkan.cpp index 47b5b124..e5635635 100644 --- a/src/vulkan.cpp +++ b/src/vulkan.cpp @@ -850,7 +850,7 @@ static void render_mpris_metadata(struct overlay_params& params, mutexed_metadat void render_benchmark(swapchain_stats& data, struct overlay_params& params, ImVec2& window_size, unsigned height, Clock::time_point now){ // TODO, FIX LOG_DURATION FOR BENCHMARK - int benchHeight = (2 + benchmark.percentile_data.size()) * params.font_size + 10.0f + 58; + int benchHeight = (2 + benchmark.percentile_data.size()) * real_font_size.x + 10.0f + 58; ImGui::SetNextWindowSize(ImVec2(window_size.x, benchHeight), ImGuiCond_Always); if (height - (window_size.y + data.main_window_pos.y + 5) < benchHeight) ImGui::SetNextWindowPos(ImVec2(data.main_window_pos.x, data.main_window_pos.y - benchHeight - 5), ImGuiCond_Always); @@ -1236,7 +1236,7 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2& } } if (params.enabled[OVERLAY_PARAM_ENABLED_frame_timing]){ - ImGui::Dummy(ImVec2(0.0f, params.font_size * params.font_scale / 2)); + ImGui::Dummy(ImVec2(0.0f, real_font_size.y)); ImGui::PushFont(data.font1); ImGui::TextColored(data.colors.engine, "%s", "Frametime"); ImGui::PopFont(); @@ -1253,12 +1253,12 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2& ImGui::PlotHistogram(hash, get_time_stat, &data, ARRAY_SIZE(data.frames_stats), 0, NULL, min_time, max_time, - ImVec2(ImGui::GetContentRegionAvailWidth() - params.font_size * params.font_scale * 2.2, 50)); + ImVec2(ImGui::GetContentRegionAvailWidth() - real_font_size.x * 2.2, 50)); } else { ImGui::PlotLines(hash, get_time_stat, &data, ARRAY_SIZE(data.frames_stats), 0, NULL, min_time, max_time, - ImVec2(ImGui::GetContentRegionAvailWidth() - params.font_size * params.font_scale * 2.2, 50)); + ImVec2(ImGui::GetContentRegionAvailWidth() - real_font_size.x * 2.2, 50)); } ImGui::PopStyleColor(); } @@ -2101,7 +2101,7 @@ void convert_colors(bool do_conv, struct swapchain_stats& sw_stats, struct overl style.Colors[ImGuiCol_PlotHistogram] = convert(params.frametime_color); style.Colors[ImGuiCol_WindowBg] = convert(params.background_color); style.Colors[ImGuiCol_Text] = convert(params.text_color); - style.CellPadding.y = -0.085 * params.font_size; + style.CellPadding.y = -0.085 * real_font_size.y; } // TODO probably needs colorspace check too