[UI] Added played game list and achievements UI.

This will be functional after GPD & SPA implementation, for now shows info about currently booted title
This commit is contained in:
Gliniak
2024-10-05 19:16:39 +02:00
committed by Radosław Gliński
parent d94940f850
commit 45332299b2
6 changed files with 903 additions and 39 deletions

View File

@@ -34,6 +34,8 @@ class ImGuiDialog;
class ImGuiNotification;
class Window;
using IconsData = std::map<uint32_t, std::pair<const uint8_t*, uint32_t>>;
class ImGuiDrawer : public WindowInputListener, public UIDrawer {
public:
ImGuiDrawer(Window* window, size_t z_order);
@@ -60,6 +62,9 @@ class ImGuiDrawer : public WindowInputListener, public UIDrawer {
void ClearDialogs();
std::map<uint32_t, std::unique_ptr<ImmediateTexture>> LoadIcons(
IconsData data);
ImmediateTexture* GetNotificationIcon(uint8_t user_index) {
if (user_index >= notification_icon_textures_.size()) {
user_index = 0;
@@ -67,6 +72,17 @@ class ImGuiDrawer : public WindowInputListener, public UIDrawer {
return notification_icon_textures_.at(user_index).get();
}
ImmediateTexture* GetLockedAchievementIcon() {
return locked_achievement_icon_.get();
}
ImFont* GetTitleFont() {
if (!GetIO().Fonts->Fonts[1]->IsLoaded()) {
return GetIO().Fonts->Fonts[0];
}
return GetIO().Fonts->Fonts[1];
}
protected:
void OnKeyDown(KeyEvent& e) override;
void OnKeyUp(KeyEvent& e) override;
@@ -80,7 +96,7 @@ class ImGuiDrawer : public WindowInputListener, public UIDrawer {
private:
void Initialize();
void InitializeFonts();
void InitializeFonts(const float font_size);
bool LoadCustomFont(ImGuiIO& io, ImFontConfig& font_config, float font_size);
bool LoadWindowsFont(ImGuiIO& io, ImFontConfig& font_config, float font_size);
bool LoadJapaneseFont(ImGuiIO& io, float font_size);
@@ -123,8 +139,10 @@ class ImGuiDrawer : public WindowInputListener, public UIDrawer {
// Resources specific to an immediate drawer - must be destroyed before
// detaching the presenter.
std::unique_ptr<ImmediateTexture> font_texture_;
std::unique_ptr<ImmediateTexture> locked_achievement_icon_;
std::vector<std::unique_ptr<ImmediateTexture>> notification_icon_textures_;
// If there's an active pointer, the ImGui mouse is controlled by this touch.
// If it's TouchEvent::kPointerIDNone, the ImGui mouse is controlled by the
// mouse.