From 44d5546ba51664fd732adf0b97a772d5c80915b1 Mon Sep 17 00:00:00 2001 From: FlightlessMango Date: Tue, 17 Nov 2020 15:09:15 +0100 Subject: [PATCH] Add param table_columns --- README.md | 1 + bin/MangoHud.conf | 1 + src/overlay_params.cpp | 4 +++- src/overlay_params.h | 3 ++- src/vulkan.cpp | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f242e171..b983248a 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu | `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 | +| `table_columns` | Set the number of table columns for ImGui, defaults to 3 | 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 85749fa7..390ab594 100644 --- a/bin/MangoHud.conf +++ b/bin/MangoHud.conf @@ -104,6 +104,7 @@ position=top-left ### Hud dimensions # width= # height= +# table_columns ### Hud transparency / alpha background_alpha=0.5 diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp index bef2370f..e9af1d2d 100644 --- a/src/overlay_params.cpp +++ b/src/overlay_params.cpp @@ -345,6 +345,7 @@ parse_font_glyph_ranges(const char *str) #define parse_permit_upload(s) parse_unsigned(s) #define parse_no_small_font(s) parse_unsigned(s) != 0 #define parse_cellpadding_y(s) parse_float(s) +#define parse_table_columns(s) parse_unsigned(s) #define parse_cpu_color(s) parse_color(s) #define parse_gpu_color(s) parse_color(s) @@ -643,7 +644,8 @@ parse_overlay_config(struct overlay_params *params, 255); } - params->tableCols = 3; + if (!params->table_columns) + params->table_columns = 3; if (!params->font_size) { params->font_size = 24; diff --git a/src/overlay_params.h b/src/overlay_params.h index ef2ff41e..8904a434 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -116,6 +116,7 @@ typedef unsigned long KeySym; OVERLAY_PARAM_CUSTOM(gpu_load_color) \ OVERLAY_PARAM_CUSTOM(cpu_load_color) \ OVERLAY_PARAM_CUSTOM(cellpadding_y) \ + OVERLAY_PARAM_CUSTOM(table_columns) \ enum overlay_param_position { LAYER_POSITION_TOP_LEFT, @@ -179,7 +180,7 @@ struct overlay_params { std::vector gpu_load_value; std::vector cpu_load_value; unsigned media_player_color; - unsigned tableCols; + unsigned table_columns; bool no_small_font; float font_size, font_scale; float font_size_text; diff --git a/src/vulkan.cpp b/src/vulkan.cpp index 503dda9e..11ea2966 100644 --- a/src/vulkan.cpp +++ b/src/vulkan.cpp @@ -953,7 +953,7 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2& if (!params.no_display){ ImGui::Begin("Main", &open, ImGuiWindowFlags_NoDecoration); - ImGui::BeginTable("hud", params.tableCols, ImGuiTableFlags_NoClipX); + ImGui::BeginTable("hud", params.table_columns, ImGuiTableFlags_NoClipX); HUDElements.place = 0; for (auto& func : HUDElements.ordered_functions){ func.first();