From 92146c58339ab81389fb92accf6fb94ff397aa98 Mon Sep 17 00:00:00 2001 From: Alessandro Toia Date: Mon, 16 Nov 2020 15:37:03 -0800 Subject: [PATCH] Add frametime param to enable/disable frametime data next to fps --- README.md | 1 + bin/MangoHud.conf | 6 +++++- src/hud_elements.cpp | 14 ++++++++------ src/overlay_params.cpp | 1 + src/overlay_params.h | 1 + 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 234762d1..a38d124c 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu | `cpu_load_color` | Set the colors for the gpu load change low,medium and high. e.g `cpu_load_color=0000FF,00FFFF,FF00FF` | | `cpu_load_value` | Set the values for medium and high load e.g `cpu_load_value=50,90` | | `cellpadding_y` | Set the vertical cellpadding, default is `-0.085` | +| `frametime` | Display frametime next to fps text | Example: `MANGOHUD_CONFIG=cpu_temp,gpu_temp,position=top-right,height=500,font_size=32` diff --git a/bin/MangoHud.conf b/bin/MangoHud.conf index 5e0e9a43..7f0cc8ce 100644 --- a/bin/MangoHud.conf +++ b/bin/MangoHud.conf @@ -38,6 +38,10 @@ gpu_stats # gpu_load_value # gpu_load_color +### Display FPS and frametime +fps +frametime + ### Display loaded MangoHud architecture # arch @@ -145,4 +149,4 @@ background_alpha=0.5 # permit_upload=1 ### Define a '+'-separated list of percentiles shown in the benchmark results. ### Use "AVG" to get a mean average. Default percentiles are 97+AVG+1+0.1 -# benchmark_percentiles= \ No newline at end of file +# benchmark_percentiles= diff --git a/src/hud_elements.cpp b/src/hud_elements.cpp index 242f6c70..5a350850 100644 --- a/src/hud_elements.cpp +++ b/src/hud_elements.cpp @@ -233,12 +233,14 @@ if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_fps]){ ImGui::PushFont(HUDElements.sw_stats->font1); ImGui::Text("FPS"); ImGui::PopFont(); - ImGui::TableNextCell(); - right_aligned_text(HUDElements.sw_stats->colors.text, HUDElements.ralign_width, "%.1f", 1000 / HUDElements.sw_stats->fps); - ImGui::SameLine(0, 1.0f); - ImGui::PushFont(HUDElements.sw_stats->font1); - ImGui::Text("ms"); - ImGui::PopFont(); + if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_frametime]){ + ImGui::TableNextCell(); + right_aligned_text(HUDElements.sw_stats->colors.text, HUDElements.ralign_width, "%.1f", 1000 / HUDElements.sw_stats->fps); + ImGui::SameLine(0, 1.0f); + ImGui::PushFont(HUDElements.sw_stats->font1); + ImGui::Text("ms"); + ImGui::PopFont(); + } } } diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp index 1db0f7ce..e0190ca1 100644 --- a/src/overlay_params.cpp +++ b/src/overlay_params.cpp @@ -500,6 +500,7 @@ parse_overlay_config(struct overlay_params *params, params->enabled[OVERLAY_PARAM_ENABLED_gpu_load_change] = false; params->enabled[OVERLAY_PARAM_ENABLED_cpu_load_change] = false; params->enabled[OVERLAY_PARAM_ENABLED_legacy_layout] = true; + params->enabled[OVERLAY_PARAM_ENABLED_frametime] = true; params->fps_sampling_period = 500000; /* 500ms */ params->width = 0; params->height = 140; diff --git a/src/overlay_params.h b/src/overlay_params.h index 314ad188..b9e2cc7f 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -56,6 +56,7 @@ typedef unsigned long KeySym; OVERLAY_PARAM_BOOL(graphs) \ OVERLAY_PARAM_BOOL(legacy_layout) \ OVERLAY_PARAM_BOOL(cpu_mhz) \ + OVERLAY_PARAM_BOOL(frametime) \ OVERLAY_PARAM_CUSTOM(fps_sampling_period) \ OVERLAY_PARAM_CUSTOM(output_folder) \ OVERLAY_PARAM_CUSTOM(output_file) \