Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/core/achievements_private.h
7520 views
1
// SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <[email protected]>
2
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
3
4
#pragma once
5
6
#include "achievements.h"
7
8
#include "rc_client.h"
9
10
#include <span>
11
#include <string>
12
#include <string_view>
13
#include <vector>
14
15
namespace Achievements {
16
17
inline constexpr float INDICATOR_FADE_IN_TIME = 0.2f;
18
inline constexpr float INDICATOR_FADE_OUT_TIME = 0.4f;
19
20
struct LeaderboardTrackerIndicator
21
{
22
u32 tracker_id;
23
std::string text;
24
float time;
25
bool active;
26
};
27
28
struct ActiveChallengeIndicator
29
{
30
const rc_client_achievement_t* achievement;
31
std::string badge_path;
32
float time_remaining;
33
float opacity;
34
bool active;
35
};
36
37
struct AchievementProgressIndicator
38
{
39
const rc_client_achievement_t* achievement;
40
std::string badge_path;
41
float time;
42
bool active;
43
};
44
45
/// Returns the rc_client instance. Should have the lock held.
46
rc_client_t* GetClient();
47
48
const rc_client_user_game_summary_t& GetGameSummary();
49
50
std::vector<LeaderboardTrackerIndicator>& GetLeaderboardTrackerIndicators();
51
std::vector<ActiveChallengeIndicator>& GetActiveChallengeIndicators();
52
std::optional<AchievementProgressIndicator>& GetActiveProgressIndicator();
53
54
std::string GetAchievementBadgePath(const rc_client_achievement_t* achievement, bool locked,
55
bool download_if_missing = true);
56
std::string GetLeaderboardUserBadgePath(const rc_client_leaderboard_entry_t* entry);
57
std::string_view GetLeaderboardFormatIcon(u32 format);
58
59
std::string GetSubsetBadgePath(const rc_client_subset_t* subset);
60
61
} // namespace Achievements
62
63
#ifndef __ANDROID__
64
65
namespace FullscreenUI {
66
67
/// Clears all cached state used to render the UI.
68
void ClearAchievementsState();
69
70
/// Updates cached data for the last progress update.
71
void UpdateAchievementsLastProgressUpdate(const rc_client_achievement_t* achievement);
72
73
} // namespace FullscreenUI
74
75
#endif // __ANDROID__
76
77