mirror of
https://github.com/flightlessmango/MangoHud.git
synced 2024-10-31 15:20:13 +00:00
Consolidate gpu load color config
This commit is contained in:
parent
5e486df67f
commit
e1269a18ff
@ -152,6 +152,19 @@ parse_color(const char *str)
|
||||
return strtol(str, NULL, 16);
|
||||
}
|
||||
|
||||
static std::vector<unsigned>
|
||||
parse_load_color(const char *str)
|
||||
{
|
||||
std::vector<unsigned> load_colors;
|
||||
std::stringstream ss(str);
|
||||
std::string token;
|
||||
while (std::getline(ss, token, ',')) {
|
||||
trim(token);
|
||||
load_colors.push_back(std::stoi(token, NULL, 16));
|
||||
}
|
||||
return load_colors;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
parse_unsigned(const char *str)
|
||||
{
|
||||
@ -324,9 +337,7 @@ parse_font_glyph_ranges(const char *str)
|
||||
#define parse_text_color(s) parse_color(s)
|
||||
#define parse_media_player_color(s) parse_color(s)
|
||||
#define parse_wine_color(s) parse_color(s)
|
||||
#define parse_gpu_load_high_color(s) parse_color(s)
|
||||
#define parse_gpu_load_med_color(s) parse_color(s)
|
||||
#define parse_gpu_load_low_color(s) parse_color(s)
|
||||
#define parse_gpu_load_color(s) parse_load_color(s)
|
||||
#define parse_gpu_load_high(s) parse_unsigned(s)
|
||||
#define parse_gpu_load_med(s) parse_unsigned(s)
|
||||
#define parse_cpu_load_high_color(s) parse_color(s)
|
||||
@ -495,9 +506,7 @@ parse_overlay_config(struct overlay_params *params,
|
||||
params->media_player_name = "";
|
||||
params->font_scale = 1.0f;
|
||||
params->wine_color = 0xeb5b5b;
|
||||
params->gpu_load_high_color = 0xb22222;
|
||||
params->gpu_load_med_color = 0xfdfd09;
|
||||
params->gpu_load_low_color = 0x39f900;
|
||||
params->gpu_load_color = {0xb22222,0xfdfd09,0x39f900};
|
||||
params->cpu_load_high_color = 0xb22222;
|
||||
params->cpu_load_med_color = 0xfdfd09;
|
||||
params->cpu_load_low_color = 0x39f900;
|
||||
@ -512,6 +521,7 @@ parse_overlay_config(struct overlay_params *params,
|
||||
params->cpu_load_high = 90;
|
||||
params->cpu_load_med = 60;
|
||||
|
||||
|
||||
#ifdef HAVE_X11
|
||||
params->toggle_hud = { XK_Shift_R, XK_F12 };
|
||||
params->toggle_fps_limit = { XK_Shift_L, XK_F1 };
|
||||
@ -598,12 +608,12 @@ parse_overlay_config(struct overlay_params *params,
|
||||
¶ms->text_color,
|
||||
¶ms->media_player_color,
|
||||
¶ms->wine_color,
|
||||
¶ms->gpu_load_high_color,
|
||||
¶ms->gpu_load_med_color,
|
||||
¶ms->gpu_load_low_color,
|
||||
¶ms->cpu_load_high_color,
|
||||
¶ms->cpu_load_med_color,
|
||||
¶ms->cpu_load_low_color,
|
||||
¶ms->gpu_load_color[0],
|
||||
¶ms->gpu_load_color[1],
|
||||
¶ms->gpu_load_color[2],
|
||||
|
||||
};
|
||||
|
||||
|
@ -92,9 +92,6 @@ typedef unsigned long KeySym;
|
||||
OVERLAY_PARAM_CUSTOM(io_color) \
|
||||
OVERLAY_PARAM_CUSTOM(text_color) \
|
||||
OVERLAY_PARAM_CUSTOM (wine_color) \
|
||||
OVERLAY_PARAM_CUSTOM(gpu_load_high_color) \
|
||||
OVERLAY_PARAM_CUSTOM(gpu_load_med_color) \
|
||||
OVERLAY_PARAM_CUSTOM(gpu_load_low_color) \
|
||||
OVERLAY_PARAM_CUSTOM(cpu_load_high_color) \
|
||||
OVERLAY_PARAM_CUSTOM(cpu_load_med_color) \
|
||||
OVERLAY_PARAM_CUSTOM(cpu_load_low_color) \
|
||||
@ -114,7 +111,8 @@ typedef unsigned long KeySym;
|
||||
OVERLAY_PARAM_CUSTOM(gpu_load_high) \
|
||||
OVERLAY_PARAM_CUSTOM(gpu_load_med) \
|
||||
OVERLAY_PARAM_CUSTOM(cpu_load_high) \
|
||||
OVERLAY_PARAM_CUSTOM(cpu_load_med)
|
||||
OVERLAY_PARAM_CUSTOM(cpu_load_med) \
|
||||
OVERLAY_PARAM_CUSTOM (gpu_load_color)
|
||||
|
||||
|
||||
enum overlay_param_position {
|
||||
@ -174,8 +172,8 @@ struct overlay_params {
|
||||
int gl_vsync;
|
||||
uint64_t log_duration;
|
||||
unsigned cpu_color, gpu_color, vram_color, ram_color, engine_color, io_color, frametime_color, background_color, text_color, wine_color;
|
||||
unsigned gpu_load_high_color, gpu_load_med_color, gpu_load_low_color;
|
||||
unsigned cpu_load_high_color, cpu_load_med_color, cpu_load_low_color;
|
||||
std::vector<unsigned> gpu_load_color;
|
||||
int gpu_load_high, gpu_load_med, gpu_load_change;
|
||||
int cpu_load_high, cpu_load_med, cpu_load_change;
|
||||
unsigned media_player_color;
|
||||
@ -198,7 +196,6 @@ struct overlay_params {
|
||||
unsigned log_interval;
|
||||
std::vector<media_player_order> media_player_order;
|
||||
std::vector<std::string> benchmark_percentiles;
|
||||
|
||||
std::string font_file, font_file_text;
|
||||
uint32_t font_glyph_ranges;
|
||||
|
||||
|
@ -1046,6 +1046,7 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2&
|
||||
// 1 is high, 2 is medium, and 3 is low load/temp
|
||||
switch (gpu_load) {
|
||||
case 1:
|
||||
///load_color = data.colors.gpu_load_high;
|
||||
load_color = data.colors.gpu_load_high;
|
||||
break;
|
||||
case 2:
|
||||
@ -2154,13 +2155,16 @@ void convert_colors(bool do_conv, struct swapchain_stats& sw_stats, struct overl
|
||||
sw_stats.colors.text = convert(params.text_color);
|
||||
sw_stats.colors.media_player = convert(params.media_player_color);
|
||||
sw_stats.colors.wine = convert(params.wine_color);
|
||||
sw_stats.colors.gpu_load_high = convert(params.gpu_load_high_color);
|
||||
sw_stats.colors.gpu_load_med = convert(params.gpu_load_med_color);
|
||||
sw_stats.colors.gpu_load_low = convert(params.gpu_load_low_color);
|
||||
sw_stats.colors.gpu_load_high = convert(params.gpu_load_color[0]);
|
||||
sw_stats.colors.gpu_load_med = convert(params.gpu_load_color[1]);
|
||||
sw_stats.colors.gpu_load_low = convert(params.gpu_load_color[2]);
|
||||
|
||||
sw_stats.colors.cpu_load_high = convert(params.cpu_load_high_color);
|
||||
sw_stats.colors.cpu_load_med = convert(params.cpu_load_med_color);
|
||||
sw_stats.colors.cpu_load_low = convert(params.cpu_load_low_color);
|
||||
|
||||
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
style.Colors[ImGuiCol_PlotLines] = convert(params.frametime_color);
|
||||
style.Colors[ImGuiCol_PlotHistogram] = convert(params.frametime_color);
|
||||
|
Loading…
Reference in New Issue
Block a user