2023-06-15 13:40:37 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-17 22:22:59 +02:00
|
|
|
#include "Common/UI/View.h"
|
2023-06-15 13:40:37 +02:00
|
|
|
#include "Common/UI/UIScreen.h"
|
|
|
|
#include "Common/UI/ViewGroup.h"
|
|
|
|
#include "UI/MiscScreens.h"
|
2023-06-16 16:29:44 +02:00
|
|
|
#include "UI/TabbedDialogScreen.h"
|
2023-06-15 13:40:37 +02:00
|
|
|
#include "Common/File/Path.h"
|
2023-06-17 22:22:59 +02:00
|
|
|
#include "UI/RetroAchievements.h"
|
2023-06-15 13:40:37 +02:00
|
|
|
|
2023-06-21 14:32:10 +02:00
|
|
|
// Lists the achievements and leaderboards for one game.
|
|
|
|
class RetroAchievementsListScreen : public TabbedUIDialogScreenWithGameBackground {
|
2023-06-15 13:40:37 +02:00
|
|
|
public:
|
2023-06-21 14:32:10 +02:00
|
|
|
RetroAchievementsListScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
|
2023-06-15 13:40:37 +02:00
|
|
|
const char *tag() const override { return "RetroAchievementsListScreen"; }
|
|
|
|
|
2023-06-21 14:32:10 +02:00
|
|
|
void CreateTabs() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool ShowSearchControls() const override { return false; }
|
2023-06-15 13:40:37 +02:00
|
|
|
};
|
2023-06-16 13:25:03 +02:00
|
|
|
|
2023-06-21 14:32:10 +02:00
|
|
|
// Lets you manage your account, and shows some achievement stats and stuff.
|
2023-06-16 16:29:44 +02:00
|
|
|
class RetroAchievementsSettingsScreen : public TabbedUIDialogScreenWithGameBackground {
|
2023-06-16 13:25:03 +02:00
|
|
|
public:
|
2023-06-16 16:29:44 +02:00
|
|
|
RetroAchievementsSettingsScreen(const Path &gamePath) : TabbedUIDialogScreenWithGameBackground(gamePath) {}
|
|
|
|
const char *tag() const override { return "RetroAchievementsSettingsScreen"; }
|
2023-06-16 13:25:03 +02:00
|
|
|
|
2023-06-16 16:29:44 +02:00
|
|
|
void CreateTabs() override;
|
|
|
|
void sendMessage(const char *message, const char *value) override;
|
|
|
|
|
2023-06-21 12:17:44 +02:00
|
|
|
protected:
|
|
|
|
bool ShowSearchControls() const override { return false; }
|
|
|
|
|
2023-06-16 16:29:44 +02:00
|
|
|
private:
|
|
|
|
void CreateAccountTab(UI::ViewGroup *viewGroup);
|
2023-06-19 23:23:50 +02:00
|
|
|
void CreateSettingsTab(UI::ViewGroup *viewGroup);
|
2023-06-27 09:47:35 +02:00
|
|
|
void CreateStatisticsTab(UI::ViewGroup *viewGroup);
|
2023-06-21 15:45:07 +02:00
|
|
|
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2023-06-21 12:17:44 +02:00
|
|
|
void MeasureAchievement(const UIContext &dc, const Achievements::Achievement &achievement, float *w, float *h);
|
2023-06-21 14:32:10 +02:00
|
|
|
void RenderAchievement(UIContext &dc, const Achievements::Achievement &achievement, AchievementRenderStyle style, const Bounds &bounds, float alpha, float startTime, float time_s);
|
2023-06-21 12:17:44 +02:00
|
|
|
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
|
|
|
|
2023-06-21 12:17:44 +02:00
|
|
|
class AchievementView : public UI::ClickableItem {
|
2023-06-17 22:22:59 +02:00
|
|
|
public:
|
2023-06-21 12:17:44 +02:00
|
|
|
AchievementView(const Achievements::Achievement &achievement, UI::LayoutParams *layoutParams = nullptr) : UI::ClickableItem(layoutParams), achievement_(achievement) {}
|
2023-06-17 22:22:59 +02:00
|
|
|
|
2023-06-21 12:17:44 +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_;
|
|
|
|
};
|
2023-06-19 23:47:23 +02:00
|
|
|
|
|
|
|
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_;
|
|
|
|
};
|