diff --git a/README.md b/README.md index 16e460c8..f2b756b5 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,8 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu | `blacklist` | Add a program to the blacklist. e.g `blacklist=vkcube,WatchDogs2.exe` | | `resolution` | Display the current resolution | | `show_fps_limit` | Display the current fps limit | -| `custom_header` | Display a custom header. e.g `custom_header=FlightLessMango Benchmarks` | +| `custom_text_center` | Display a custom text centered useful for a header e.g `custom_text_center=FlightLessMango Benchmarks` | +| `custom_text` | Display a custom text e.g `custom_text=Fsync enabled` | Example: `MANGOHUD_CONFIG=cpu_temp,gpu_temp,position=top-right,height=500,font_size=32` Because comma is also used as option delimiter and needs to be escaped for values with a backslash, you can use `+` like `MANGOHUD_CONFIG=fps_limit=60+30+0` instead. diff --git a/bin/MangoHud.conf b/bin/MangoHud.conf index 35a07759..8f2af801 100644 --- a/bin/MangoHud.conf +++ b/bin/MangoHud.conf @@ -16,8 +16,8 @@ ################### VISUAL ################### -### Custom Header -# custom_header = +### Custom text centered useful for a header +# custom_text_center = ### Legacy Layout legacy_layout @@ -65,6 +65,8 @@ frame_timing ### Show current fps limit # show_fps_limit +### Display custom text +# custom_text ### Time formatting examples # time_format = %H:%M diff --git a/src/hud_elements.cpp b/src/hud_elements.cpp index 36ebfdd5..0ab7bdfe 100644 --- a/src/hud_elements.cpp +++ b/src/hud_elements.cpp @@ -497,16 +497,23 @@ void HudElements::show_fps_limit(){ ImGui::PopFont(); } -void HudElements::custom_header(){ +void HudElements::custom_text_center(){ ImGui::TableNextRow(); ImGui::PushFont(HUDElements.sw_stats->font1); - std::string text = HUDElements.params->custom_header; + std::string text = HUDElements.params->custom_text_center; center_text(text); ImGui::TextColored(HUDElements.colors.text, "%s",text.c_str()); ImGui::NewLine(); ImGui::PopFont(); } +void HudElements::custom_text(){ + ImGui::TableNextRow(); + ImGui::PushFont(HUDElements.sw_stats->font1); + ImGui::TextColored(HUDElements.colors.text, "%s",HUDElements.params->custom_text.c_str()); + ImGui::PopFont(); +} + void HudElements::graphs(){ ImGui::TableNextRow(); ImGui::Dummy(ImVec2(0.0f, real_font_size.y)); @@ -631,27 +638,29 @@ void HudElements::sort_elements(std::pair option){ auto param = option.first; auto value = option.second; - if (param == "custom_header"){ - ordered_functions.insert(ordered_functions.begin(),std::make_pair(custom_header,value)); - } - if (param == "version") { ordered_functions.push_back({version, value}); } - if (param == "time") { ordered_functions.push_back({time, value}); } - if (param == "gpu_stats") { ordered_functions.push_back({gpu_stats, value}); } - if (param == "cpu_stats") { ordered_functions.push_back({cpu_stats, value}); } - if (param == "core_load") { ordered_functions.push_back({core_load, value}); } - if (param == "io_stats") { ordered_functions.push_back({io_stats, value}); } - if (param == "vram") { ordered_functions.push_back({vram, value}); } - if (param == "ram") { ordered_functions.push_back({ram, value}); } - if (param == "fps") { ordered_functions.push_back({fps, value}); } - if (param == "engine_version") { ordered_functions.push_back({engine_version, value}); } - if (param == "gpu_name") { ordered_functions.push_back({gpu_name, value}); } - if (param == "vulkan_driver") { ordered_functions.push_back({vulkan_driver, value}); } - if (param == "arch") { ordered_functions.push_back({arch, value}); } - if (param == "wine") { ordered_functions.push_back({wine, value}); } - if (param == "frame_timing") { ordered_functions.push_back({frame_timing, value}); } - if (param == "media_player") { ordered_functions.push_back({media_player, value}); } - if (param == "resolution") { ordered_functions.push_back({resolution, value}); } - if (param == "show_fps_limit") { ordered_functions.push_back({show_fps_limit, value}); } + // Use this to always add to front of vector + //ordered_functions.insert(ordered_functions.begin(),std::make_pair(param,value)); + + if (param == "version") { ordered_functions.push_back({version, value}); } + if (param == "time") { ordered_functions.push_back({time, value}); } + if (param == "gpu_stats") { ordered_functions.push_back({gpu_stats, value}); } + if (param == "cpu_stats") { ordered_functions.push_back({cpu_stats, value}); } + if (param == "core_load") { ordered_functions.push_back({core_load, value}); } + if (param == "io_stats") { ordered_functions.push_back({io_stats, value}); } + if (param == "vram") { ordered_functions.push_back({vram, value}); } + if (param == "ram") { ordered_functions.push_back({ram, value}); } + if (param == "fps") { ordered_functions.push_back({fps, value}); } + if (param == "engine_version") { ordered_functions.push_back({engine_version, value}); } + if (param == "gpu_name") { ordered_functions.push_back({gpu_name, value}); } + if (param == "vulkan_driver") { ordered_functions.push_back({vulkan_driver, value}); } + if (param == "arch") { ordered_functions.push_back({arch, value}); } + if (param == "wine") { ordered_functions.push_back({wine, value}); } + if (param == "frame_timing") { ordered_functions.push_back({frame_timing, value}); } + if (param == "media_player") { ordered_functions.push_back({media_player, value}); } + if (param == "resolution") { ordered_functions.push_back({resolution, value}); } + if (param == "show_fps_limit") { ordered_functions.push_back({show_fps_limit, value}); } + if (param == "custom_text") { ordered_functions.push_back({custom_text, value}); } + if (param == "custom_text_center") { ordered_functions.push_back({custom_text_center, value}); } if (param == "graphs"){ if (!HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs]) HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs] = true; @@ -669,7 +678,7 @@ void HudElements::sort_elements(std::pair option){ void HudElements::legacy_elements(){ string value = "NULL"; ordered_functions.clear(); - ordered_functions.push_back({custom_header, value}); + ordered_functions.push_back({custom_text_center, value}); ordered_functions.push_back({time, value}); ordered_functions.push_back({version, value}); ordered_functions.push_back({gpu_stats, value}); diff --git a/src/hud_elements.h b/src/hud_elements.h index 4053471b..6a2d9fcf 100644 --- a/src/hud_elements.h +++ b/src/hud_elements.h @@ -40,9 +40,9 @@ class HudElements{ static void frame_timing(); static void media_player(); static void resolution(); - static void custom_text(); static void show_fps_limit(); - static void custom_header(); + static void custom_text_center(); + static void custom_text(); static void graphs(); void convert_colors(struct overlay_params& params); diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp index 32a00b9e..50cab95c 100644 --- a/src/overlay_params.cpp +++ b/src/overlay_params.cpp @@ -397,7 +397,8 @@ parse_font_glyph_ranges(const char *str) #define parse_gpu_load_value(s) parse_load_value(s) #define parse_cpu_load_value(s) parse_load_value(s) #define parse_blacklist(s) parse_str_tokenize(s) -#define parse_custom_header(s) parse_str(s) +#define parse_custom_text_center(s) parse_str(s) +#define parse_custom_text(s) parse_str(s) static bool diff --git a/src/overlay_params.h b/src/overlay_params.h index 464e8dfb..1640c642 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -122,7 +122,8 @@ typedef unsigned long KeySym; OVERLAY_PARAM_CUSTOM(table_columns) \ OVERLAY_PARAM_CUSTOM(blacklist) \ OVERLAY_PARAM_CUSTOM(autostart_log) \ - OVERLAY_PARAM_CUSTOM(custom_header) \ + OVERLAY_PARAM_CUSTOM(custom_text_center) \ + OVERLAY_PARAM_CUSTOM(custom_text) \ enum overlay_param_position { LAYER_POSITION_TOP_LEFT, @@ -203,15 +204,14 @@ struct overlay_params { std::string pci_dev; std::string media_player_name; std::string cpu_text, gpu_text; - //std::string blacklist; std::vector blacklist; unsigned log_interval, autostart_log; std::vector media_player_order; std::vector benchmark_percentiles; std::string font_file, font_file_text; uint32_t font_glyph_ranges; - - std::string custom_header; + std::string custom_text_center; + std::string custom_text; std::string config_file_path; std::unordered_map options; int permit_upload;