Add sorting for env var

This commit is contained in:
FlightlessMango 2020-11-03 22:28:48 +01:00
parent dbfbd05ecf
commit 6e7747c73c
2 changed files with 5 additions and 5 deletions

View File

@ -362,7 +362,7 @@ void HudElements::media_player(){
void HudElements::sort_elements(std::string string){
if (string == "version")
ordered_functions.push_back(&version);
ordered_functions.push_back(version);
if (string == "time")
ordered_functions.push_back(time);
if (string == "gpu_stats")

View File

@ -441,6 +441,7 @@ parse_overlay_env(struct overlay_params *params,
char key[256], value[256];
while ((num = parse_string(env, key, value)) != 0) {
env += num;
HUDElements.sort_elements(key);
if (!strcmp("full", key)) {
bool read_cfg = params->enabled[OVERLAY_PARAM_ENABLED_read_cfg];
#define OVERLAY_PARAM_BOOL(name) \
@ -559,7 +560,7 @@ parse_overlay_config(struct overlay_params *params,
#define parse_reload_cfg(x) params->reload_cfg
#endif
HUDElements.ordered_functions.clear();
// first pass with env var
if (env)
parse_overlay_env(params, env);
@ -600,8 +601,8 @@ parse_overlay_config(struct overlay_params *params,
}
// second pass, override config file settings with MANGOHUD_CONFIG
if (env && read_cfg)
parse_overlay_env(params, env);
// if (env && read_cfg)
// parse_overlay_env(params, env);
if (params->font_scale_media_player <= 0.f)
params->font_scale_media_player = 0.55f;
@ -670,7 +671,6 @@ parse_overlay_config(struct overlay_params *params,
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);
HUDElements.ordered_functions.clear();
for (auto& option : HUDElements.options)
HUDElements.sort_elements(option);
}