Push params to HudElements options

This commit is contained in:
FlightlessMango 2020-11-03 15:34:18 +01:00
parent 7471d42cac
commit 378cc1e089
4 changed files with 18 additions and 2 deletions

View File

@ -6,7 +6,7 @@
#include "config.h"
#include "file_utils.h"
#include "string_utils.h"
#include "hud_elements.h"
std::string program_name;
void parseConfigLine(std::string line, std::unordered_map<std::string,std::string>& options) {
@ -24,8 +24,10 @@ void parseConfigLine(std::string line, std::unordered_map<std::string,std::strin
param = line.substr(0, equal);
trim(param);
trim(value);
if (!param.empty())
if (!param.empty()){
HUDElements.options.push_back(param);
options[param] = value;
}
}
void enumerate_config_files(std::vector<std::string>& paths)
@ -67,6 +69,7 @@ void enumerate_config_files(std::vector<std::string>& paths)
}
void parseConfigFile(overlay_params& params) {
HUDElements.options.clear();
params.options.clear();
std::vector<std::string> paths;
const char *cfg_file = getenv("MANGOHUD_CONFIGFILE");

3
src/hud_elements.cpp Normal file
View File

@ -0,0 +1,3 @@
#include "hud_elements.h"
HudElements HUDElements;

9
src/hud_elements.h Normal file
View File

@ -0,0 +1,9 @@
#pragma once
#include "overlay.h"
#include "overlay_params.h"
class HudElements{
public:
std::vector<std::string> options;
};
extern HudElements HUDElements;

View File

@ -27,6 +27,7 @@ foreach s : ['overlay.frag', 'overlay.vert']
endforeach
vklayer_files = files(
'hud_elements.cpp',
'overlay.cpp',
'overlay_params.cpp',
'font.cpp',