Achievements: Handle dynamically-sized leaderboard trackers

This commit is contained in:
Stenzek 2023-12-04 22:30:39 +10:00 committed by Connor McLaughlin
parent 0f4a95e31b
commit 971929777d
1 changed files with 1 additions and 3 deletions

View File

@ -105,7 +105,6 @@ namespace Achievements
u32 tracker_id;
std::string text;
Common::Timer show_hide_time;
u32 display_length;
bool active;
};
@ -1226,7 +1225,6 @@ void Achievements::HandleLeaderboardTrackerShowEvent(const rc_client_event_t* ev
LeaderboardTrackerIndicator indicator;
indicator.tracker_id = event->leaderboard_tracker->id;
indicator.text = event->leaderboard_tracker->display;
indicator.display_length = static_cast<u32>(std::strlen(event->leaderboard_tracker->display));
indicator.active = true;
s_active_leaderboard_trackers.push_back(std::move(indicator));
}
@ -1983,7 +1981,7 @@ void Achievements::DrawGameOverlays()
TinyString width_string;
width_string.append(ICON_FA_STOPWATCH);
for (u32 i = 0; i < indicator.display_length; i++)
for (u32 i = 0; i < indicator.text.length(); i++)
width_string.append('0');
const ImVec2 size = ImGuiFullscreen::g_medium_font->CalcTextSizeA(
ImGuiFullscreen::g_medium_font->FontSize, FLT_MAX, 0.0f, width_string.c_str(), width_string.end_ptr());