From bc89947df0e515f335425123f1494bab95caddc0 Mon Sep 17 00:00:00 2001 From: FlightlessMango Date: Fri, 9 Sep 2022 23:51:33 +0200 Subject: [PATCH] hud_elements: battery: don't show plug or watt in horizontal --- src/hud_elements.cpp | 52 +++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/src/hud_elements.cpp b/src/hud_elements.cpp index 66d5c1f..d7c47e0 100644 --- a/src/hud_elements.cpp +++ b/src/hud_elements.cpp @@ -754,31 +754,33 @@ void HudElements::battery(){ ImGui::SameLine(0,1.0f); ImGui::Text("%%"); } - if (Battery_Stats.current_watt != 0) { - ImguiNextColumnOrNewRow(); - right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.1f", Battery_Stats.current_watt); - ImGui::SameLine(0,1.0f); - ImGui::PushFont(HUDElements.sw_stats->font1); - ImGui::Text("W"); - ImGui::PopFont(); - ImGui::TableNextColumn(); - float hours; - float minutes; - // float seconds; - minutes = std::modf(Battery_Stats.remaining_time, &hours); - minutes *= 60; - // seconds = std::modf(minutes, &minutes); - // seconds *= 60; - ImGui::PushFont(HUDElements.sw_stats->font1); - ImGui::TextColored(HUDElements.colors.text, "%s", "Remaining Time"); - ImGui::PopFont(); - ImGuiTableSetColumnIndex(2); - // ImGui::TextColored(HUDElements.colors.text, "%02.0f:%02.0f:%02.0f", hours, minutes, seconds); - right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%02.0f:%02.0f", hours, minutes); - } - else { - ImguiNextColumnOrNewRow(); - right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%s", ICON_FK_PLUG); + if (!HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_horizontal]) { + if (Battery_Stats.current_watt != 0) { + ImguiNextColumnOrNewRow(); + right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.1f", Battery_Stats.current_watt); + ImGui::SameLine(0,1.0f); + ImGui::PushFont(HUDElements.sw_stats->font1); + ImGui::Text("W"); + ImGui::PopFont(); + ImGui::TableNextColumn(); + float hours; + float minutes; + // float seconds; + minutes = std::modf(Battery_Stats.remaining_time, &hours); + minutes *= 60; + // seconds = std::modf(minutes, &minutes); + // seconds *= 60; + ImGui::PushFont(HUDElements.sw_stats->font1); + ImGui::TextColored(HUDElements.colors.text, "%s", "Remaining Time"); + ImGui::PopFont(); + ImGuiTableSetColumnIndex(2); + // ImGui::TextColored(HUDElements.colors.text, "%02.0f:%02.0f:%02.0f", hours, minutes, seconds); + right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%02.0f:%02.0f", hours, minutes); + } + else { + ImguiNextColumnOrNewRow(); + right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%s", ICON_FK_PLUG); + } } } }