Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 9 additions & 26 deletions src/hud_elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,6 @@ static void ImguiNextColumnOrNewRow(int column = -1)
static bool ImGuiTextOverflow(const char* text) {
return ImGui::CalcTextSize(text).x > ImGui::CalcItemWidth() + HUDElements.ralign_width / 2;
}
// This function is only used in battery and battery is not used in windows builds
// Battery should probably be reworked to not use this func since nothing else needs it
#ifdef __linux__
static void ImGuiTableSetColumnIndex(int column)
{
ImGui::TableSetColumnIndex(std::max(0, std::min(column, ImGui::TableGetColumnCount() - 1)));
}
#endif

void HudElements::time(){
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_time]){
Expand Down Expand Up @@ -1267,24 +1259,15 @@ void HudElements::battery(){
char time_buffer[32];
snprintf(time_buffer, sizeof(time_buffer), "%02d:%02d", static_cast<int>(hours), static_cast<int>(minutes));

if (!HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_horizontal] && !HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_hud_compact]){
ImGui::TableNextRow();
ImGui::NextColumn();
ImGui::PushFont(HUDElements.sw_stats->font_small);
ImGuiTableSetColumnIndex(0);
HUDElements.TextColored(HUDElements.colors.text, "%s", "Remaining Time");
ImGui::PopFont();
ImGuiTableSetColumnIndex(2);
} else {
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_horizontal])
ImguiNextColumnOrNewRow();

ImguiNextColumnOrNewRow();
}
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_hud_compact])
ImGuiTableSetColumnIndex(0);

right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%s", time_buffer);
ImguiNextColumnOrNewRow();
if (!HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_horizontal])
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%s", time_buffer);
else
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width * 1.25f, "%s", time_buffer);
ImGui::SameLine(0, 1.0f);
ImGui::PushFont(HUDElements.sw_stats->font_small);
HUDElements.TextColored(HUDElements.colors.text, "REM");
ImGui::PopFont();
}
} else {
ImguiNextColumnOrNewRow();
Expand Down