Clean up Push/Pop font calls in check and item trackers by adding them instead to Begin/EndFloatWindows functions. (#5122)

Add missing PopFont call to entrance tracker.
This commit is contained in:
Malkierian 2025-03-16 13:51:52 -07:00 committed by GitHub
commit 5b622683f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 8 deletions

View file

@ -876,8 +876,6 @@ void CheckTrackerWindow::DrawElement() {
hideShopUnshuffledChecks = CVarGetInteger(CVAR_TRACKER_CHECK("HideUnshuffledShopChecks"), 1); hideShopUnshuffledChecks = CVarGetInteger(CVAR_TRACKER_CHECK("HideUnshuffledShopChecks"), 1);
alwaysShowGS = CVarGetInteger(CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), 0); alwaysShowGS = CVarGetInteger(CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), 0);
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
if (CVarGetInteger(CVAR_TRACKER_CHECK("ShowOnlyPaused"), 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) { if (CVarGetInteger(CVAR_TRACKER_CHECK("ShowOnlyPaused"), 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) {
return; return;
@ -901,7 +899,6 @@ void CheckTrackerWindow::DrawElement() {
if (!GameInteractor::IsSaveLoaded() || !initialized) { if (!GameInteractor::IsSaveLoaded() || !initialized) {
ImGui::Text("Waiting for file load..."); //TODO Language ImGui::Text("Waiting for file load..."); //TODO Language
ImGui::PopFont();
EndFloatWindows(); EndFloatWindows();
return; return;
} }
@ -920,7 +917,6 @@ void CheckTrackerWindow::DrawElement() {
ImVec2 size = ImGui::GetContentRegionMax(); ImVec2 size = ImGui::GetContentRegionMax();
size.y -= headerHeight; size.y -= headerHeight;
if (!ImGui::BeginTable("Check Tracker", 1, 0, size)) { if (!ImGui::BeginTable("Check Tracker", 1, 0, size)) {
ImGui::PopFont();
EndFloatWindows(); EndFloatWindows();
return; return;
} }
@ -965,7 +961,6 @@ void CheckTrackerWindow::DrawElement() {
size = ImGui::GetContentRegionAvail(); size = ImGui::GetContentRegionAvail();
if (!ImGui::BeginTable("CheckTracker##Checks", 1, ImGuiTableFlags_ScrollY, size)) { if (!ImGui::BeginTable("CheckTracker##Checks", 1, ImGuiTableFlags_ScrollY, size)) {
ImGui::EndTable(); ImGui::EndTable();
ImGui::PopFont();
EndFloatWindows(); EndFloatWindows();
return; return;
} }
@ -1081,7 +1076,6 @@ void CheckTrackerWindow::DrawElement() {
ImGui::EndTable(); //Checks Lead-out ImGui::EndTable(); //Checks Lead-out
ImGui::EndTable(); //Quick Options Lead-out ImGui::EndTable(); //Quick Options Lead-out
ImGui::PopFont();
EndFloatWindows(); EndFloatWindows();
if (doingCollapseOrExpand) { if (doingCollapseOrExpand) {
optCollapseAll = false; optCollapseAll = false;
@ -1147,12 +1141,14 @@ void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flag
Color_Background.b / 255.0f, Color_Background.a / 255.0f)); Color_Background.b / 255.0f, Color_Background.a / 255.0f));
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
ImGui::Begin(UniqueName.c_str(), &open, windowFlags); ImGui::Begin(UniqueName.c_str(), &open, windowFlags);
} }
void EndFloatWindows() { void EndFloatWindows() {
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::PopFont();
ImGui::End(); ImGui::End();
} }

View file

@ -740,6 +740,7 @@ void EntranceTrackerWindow::DrawElement() {
if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End(); ImGui::End();
ImGui::PopFont();
return; return;
} }

View file

@ -952,12 +952,14 @@ void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) {
ImGui::PushStyleColor(ImGuiCol_WindowBg, VecFromRGBA8(CVarGetColor(CVAR_TRACKER_ITEM("BgColor.Value"), {0, 0, 0, 0}))); ImGui::PushStyleColor(ImGuiCol_WindowBg, VecFromRGBA8(CVarGetColor(CVAR_TRACKER_ITEM("BgColor.Value"), {0, 0, 0, 0})));
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
ImGui::Begin(UniqueName.c_str(), nullptr, windowFlags); ImGui::Begin(UniqueName.c_str(), nullptr, windowFlags);
} }
void EndFloatingWindows() { void EndFloatingWindows() {
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::PopFont();
ImGui::End(); ImGui::End();
} }
@ -1222,7 +1224,6 @@ void ItemTrackerWindow::Draw() {
} }
void ItemTrackerWindow::DrawElement() { void ItemTrackerWindow::DrawElement() {
ImGui::PushFont(OTRGlobals::Instance->fontStandardLarger);
UpdateVectors(); UpdateVectors();
int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
@ -1353,7 +1354,6 @@ void ItemTrackerWindow::DrawElement() {
EndFloatingWindows(); EndFloatingWindows();
} }
} }
ImGui::PopFont();
} }
static std::unordered_map<int32_t, const char*> itemTrackerCapacityTrackOptions = { static std::unordered_map<int32_t, const char*> itemTrackerCapacityTrackOptions = {