From 267c27036c2e334a351548e41f1b15869f57fe6a Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Tue, 23 Aug 2022 08:06:53 -0500 Subject: [PATCH] Allow aligning text to the left --- .../Enhancements/randomizer/randomizer_item_tracker.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 76d28a0b7..23c65bc13 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -271,8 +271,9 @@ void DrawItemCount(ItemTrackerItem item) { if (currentAndMax.x > 0) { if (currentAndMax.x >= currentAndMax.y) { std::string currentString = std::to_string((int)currentAndMax.x); + float x = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) ? p.x : p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2); - ImGui::SetCursorScreenPos(ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2), p.y - 14)); + ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14)); ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 255, 0, 255)); ImGui::Text("%d", (int)currentAndMax.x); ImGui::PopStyleColor(); @@ -288,8 +289,9 @@ void DrawItemCount(ItemTrackerItem item) { ImGui::PopStyleColor(); } else { std::string currentString = std::to_string((int)currentAndMax.x); + float x = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) ? p.x : p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2); - ImGui::SetCursorScreenPos(ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2), p.y - 14)); + ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14)); ImGui::Text("%d", (int)currentAndMax.x); } } @@ -789,6 +791,9 @@ void DrawItemTrackerOptions(bool& open) { SohImGui::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gItemTrackerIconSize", 25, 128, "", 36, true); SohImGui::EnhancementSliderInt("Icon margins : %dpx", "##ITEMTRACKERSPACING", "gItemTrackerIconSpacing", -5, 50, "", 12, true); PaddedEnhancementCheckbox("Display \"Current/Max\" values", "gItemTrackerDisplayCurrentMax", 0); + if (CVar_GetS32("gItemTrackerDisplayCurrentMax", 0) == 0) { + PaddedEnhancementCheckbox("Align count to left side", "gItemTrackerCurrentOnLeft", 0); + } ImGui::TableNextColumn();