FullscreenUI: Redo landing page and add help bar

This commit is contained in:
Stenzek
2024-04-09 20:04:45 +10:00
parent d4d7a13fed
commit bf4e8feb25
17 changed files with 1006 additions and 220 deletions

View File

@ -1725,16 +1725,7 @@ void Achievements::ShowLoginNotification()
if (g_settings.achievements_notifications && FullscreenUI::Initialize())
{
std::string badge_path = GetUserBadgePath(user->username);
if (!FileSystem::FileExists(badge_path.c_str()))
{
char url[512];
const int res = rc_client_user_get_image_url(user, url, std::size(url));
if (res == RC_OK)
DownloadImage(url, badge_path);
else
ReportRCError(res, "rc_client_user_get_image_url() failed: ");
}
std::string badge_path = GetLoggedInUserBadgePath();
//: Summary for login notification.
std::string title = user->display_name;
@ -1746,6 +1737,37 @@ void Achievements::ShowLoginNotification()
}
}
const char* Achievements::GetLoggedInUserName()
{
const rc_client_user_t* user = rc_client_get_user_info(s_client);
if (!user) [[unlikely]]
return nullptr;
return user->username;
}
std::string Achievements::GetLoggedInUserBadgePath()
{
std::string badge_path;
const rc_client_user_t* user = rc_client_get_user_info(s_client);
if (!user) [[unlikely]]
return badge_path;
badge_path = GetUserBadgePath(user->username);
if (!FileSystem::FileExists(badge_path.c_str())) [[unlikely]]
{
char url[512];
const int res = rc_client_user_get_image_url(user, url, std::size(url));
if (res == RC_OK)
DownloadImage(url, badge_path);
else
ReportRCError(res, "rc_client_user_get_image_url() failed: ");
}
return badge_path;
}
void Achievements::Logout()
{
if (IsActive())
@ -2290,6 +2312,8 @@ void Achievements::DrawAchievementsWindow()
ImGuiFullscreen::EndMenuButtons();
}
ImGuiFullscreen::EndFullscreenWindow();
FullscreenUI::SetStandardSelectionFooterText(true);
}
void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
@ -2705,6 +2729,7 @@ void Achievements::DrawLeaderboardsWindow()
}
}
ImGuiFullscreen::EndFullscreenWindow();
FullscreenUI::SetStandardSelectionFooterText(true);
if (!is_leaderboard_open)
{