From 77b3033cc7685327571825b1e54f95ab391e55a3 Mon Sep 17 00:00:00 2001 From: FlightlessMango Date: Wed, 11 Mar 2020 06:07:41 +0100 Subject: [PATCH] Removed frametime_alpha and replace it with an overall alpha for text and frametime --- src/overlay.cpp | 5 +++-- src/overlay_params.cpp | 13 ++++--------- src/overlay_params.h | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/overlay.cpp b/src/overlay.cpp index 2443bbf4..0ff7669b 100644 --- a/src/overlay.cpp +++ b/src/overlay.cpp @@ -1013,6 +1013,7 @@ void position_layer(struct overlay_params& params, ImVec2 window_size, unsigned ImGui::SetNextWindowSize(window_size, ImGuiCond_Always); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(8,-3)); + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, params.alpha); switch (params.position) { case LAYER_POSITION_TOP_LEFT: @@ -1073,7 +1074,7 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2& ImGui::TableNextCell(); right_aligned_text(char_width * 4, "%i", gpu_info.temp); ImGui::SameLine(0, 1.0f); - ImGui::Text("°C"); + ImGui::TextColored(ImVec4(1.0, 1.0, 1.0, 1.0), "°C"); } if (params.enabled[OVERLAY_PARAM_ENABLED_gpu_core_clock]){ ImGui::TableNextCell(); @@ -1291,7 +1292,7 @@ static void compute_swapchain_display(struct swapchain_data *data) position_layer(instance_data->params, data->window_size, data->width, data->height); render_imgui(data->sw_stats, instance_data->params, data->window_size, data->width, data->height); - ImGui::PopStyleVar(2); + ImGui::PopStyleVar(3); ImGui::EndFrame(); ImGui::Render(); diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp index 6f63278e..364f9d46 100644 --- a/src/overlay_params.cpp +++ b/src/overlay_params.cpp @@ -83,7 +83,7 @@ parse_background_alpha(const char *str) } static float -parse_frametime_alpha(const char *str) +parse_alpha(const char *str) { return strtof(str, NULL); } @@ -310,7 +310,7 @@ parse_overlay_config(struct overlay_params *params, params->offset_x = 0; params->offset_y = 0; params->background_alpha = 0.5; - params->frametime_alpha = 1.0; + params->alpha = 1.0; params->time_format = "%T"; params->gpu_color = strtol("2e9762", NULL, 16); params->cpu_color = strtol("2e97cb", NULL, 16); @@ -368,7 +368,7 @@ parse_overlay_config(struct overlay_params *params, // Command buffer gets reused and timestamps cause hangs for some reason, force off for now params->enabled[OVERLAY_PARAM_ENABLED_gpu_timing] = false; // Convert from 0xRRGGBB to ImGui's format - std::array colors = { + std::array colors = { ¶ms->crosshair_color, ¶ms->cpu_color, ¶ms->gpu_color, @@ -377,6 +377,7 @@ parse_overlay_config(struct overlay_params *params, ¶ms->engine_color, ¶ms->io_color, ¶ms->background_color, + ¶ms->frametime_color, }; for (auto color : colors){ @@ -387,12 +388,6 @@ parse_overlay_config(struct overlay_params *params, 255); } - params->frametime_color = - IM_COL32(RGBGetRValue(params->frametime_color), - RGBGetGValue(params->frametime_color), - RGBGetBValue(params->frametime_color), - params->frametime_alpha * 255); - params->tableCols = 3; if (!params->font_size) { diff --git a/src/overlay_params.h b/src/overlay_params.h index 625080c1..0b060498 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -89,9 +89,9 @@ extern "C" { OVERLAY_PARAM_CUSTOM(ram_color) \ OVERLAY_PARAM_CUSTOM(engine_color) \ OVERLAY_PARAM_CUSTOM(frametime_color) \ - OVERLAY_PARAM_CUSTOM(frametime_alpha) \ OVERLAY_PARAM_CUSTOM(background_color) \ OVERLAY_PARAM_CUSTOM(io_color) \ + OVERLAY_PARAM_CUSTOM(alpha) \ OVERLAY_PARAM_CUSTOM(help) enum overlay_param_position { @@ -129,7 +129,7 @@ struct overlay_params { unsigned crosshair_color, cpu_color, gpu_color, vram_color, ram_color, engine_color, io_color, frametime_color, background_color; unsigned tableCols; float font_size; - float background_alpha, frametime_alpha; + float background_alpha, alpha; KeySym toggle_hud; KeySym toggle_logging; KeySym refresh_config;