ppsspp/UI/RetroAchievementScreens.h

76 lines
2.7 KiB
C
Raw Normal View History

#pragma once
2023-06-17 22:22:59 +02:00
#include "Common/UI/View.h"
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "UI/MiscScreens.h"
#include "UI/TabbedDialogScreen.h"
#include "Common/File/Path.h"
2023-06-17 22:22:59 +02:00
#include "UI/RetroAchievements.h"
// Lists the achievements and leaderboards for one game.
class RetroAchievementsListScreen : public TabbedUIDialogScreenWithGameBackground {
public:
RetroAchievementsListScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
const char *tag() const override { return "RetroAchievementsListScreen"; }
void CreateTabs() override;
protected:
bool ShowSearchControls() const override { return false; }
};
2023-06-16 13:25:03 +02:00
// Lets you manage your account, and shows some achievement stats and stuff.
class RetroAchievementsSettingsScreen : public TabbedUIDialogScreenWithGameBackground {
2023-06-16 13:25:03 +02:00
public:
RetroAchievementsSettingsScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
const char *tag() const override { return "RetroAchievementsSettingsScreen"; }
2023-06-16 13:25:03 +02:00
void CreateTabs() override;
void sendMessage(const char *message, const char *value) override;
protected:
bool ShowSearchControls() const override { return false; }
private:
void CreateAccountTab(UI::ViewGroup *viewGroup);
void CreateSettingsTab(UI::ViewGroup *viewGroup);
void CreateStatisticsTab(UI::ViewGroup *viewGroup);
std::string username_;
std::string password_;
2023-06-16 13:25:03 +02:00
};
2023-06-17 22:22:59 +02:00
class UIContext;
enum class AchievementRenderStyle {
LISTED,
UNLOCKED,
};
void MeasureAchievement(const UIContext &dc, const Achievements::Achievement &achievement, float *w, float *h);
void RenderAchievement(UIContext &dc, const Achievements::Achievement &achievement, AchievementRenderStyle style, const Bounds &bounds, float alpha, float startTime, float time_s);
void MeasureGameAchievementSummary(const UIContext &dc, int gameID, float *w, float *h);
void RenderGameAchievementSummary(UIContext &dc, int gameID, const Bounds &bounds, float alpha);
2023-06-17 22:22:59 +02:00
class AchievementView : public UI::ClickableItem {
2023-06-17 22:22:59 +02:00
public:
AchievementView(const Achievements::Achievement &achievement, UI::LayoutParams *layoutParams = nullptr) : UI::ClickableItem(layoutParams), achievement_(achievement) {}
2023-06-17 22:22:59 +02:00
void Click() override;
2023-06-17 22:22:59 +02:00
void Draw(UIContext &dc) override;
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override;
private:
Achievements::Achievement achievement_;
};
class GameAchievementSummaryView : public UI::Item {
public:
GameAchievementSummaryView(int gameID, UI::LayoutParams *layoutParams = nullptr) : UI::Item(layoutParams), gameID_(gameID) {}
void Draw(UIContext &dc) override;
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override;
private:
int gameID_;
};