FullscreenUI: Add icons to game list detail lines

This commit is contained in:
Stenzek 2025-07-02 20:44:48 +10:00
parent 38022afa25
commit d852149809
No known key found for this signature in database
4 changed files with 21 additions and 8 deletions

View File

@ -31,3 +31,9 @@
#define ICON_EMOJI_PROHIBITED "\xf0\x9f\x9a\xab" #define ICON_EMOJI_PROHIBITED "\xf0\x9f\x9a\xab"
#define ICON_EMOJI_CALENDAR "\xF0\x9F\x93\x85" #define ICON_EMOJI_CALENDAR "\xF0\x9F\x93\x85"
#define ICON_EMOJI_HOURGLASS "\xe2\x8f\xb3" #define ICON_EMOJI_HOURGLASS "\xe2\x8f\xb3"
#define ICON_EMOJI_TROPHY "\xf0\x9f\x8f\x86"
#define ICON_EMOJI_GLOBE "\xf0\x9f\x8c\x8e"
#define ICON_EMOJI_BOOKS "\xf0\x9f\x93\x9a"
#define ICON_EMOJI_STAR "\xe2\xad\x90"
#define ICON_EMOJI_RULER "\xf0\x9f\x93\x8f"
#define ICON_EMOJI_CLOCK_FIVE_OCLOCK "\xf0\x9f\x95\x94"

View File

@ -8200,7 +8200,8 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
{ {
const bool display_as_language = (selected_entry->dbentry && selected_entry->dbentry->HasAnyLanguage()); const bool display_as_language = (selected_entry->dbentry && selected_entry->dbentry->HasAnyLanguage());
ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight);
ImGui::TextUnformatted(display_as_language ? FSUI_CSTR("Language: ") : FSUI_CSTR("Region: ")); ImGuiFullscreen::TextUnformatted(
FSUI_ICONVSTR(ICON_EMOJI_GLOBE, display_as_language ? FSUI_CSTR("Language: ") : FSUI_CSTR("Region: ")));
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::Image(GetCachedTexture(selected_entry->GetLanguageIconName(), 23, 16), LayoutScale(23.0f, 16.0f)); ImGui::Image(GetCachedTexture(selected_entry->GetLanguageIconName(), 23, 16), LayoutScale(23.0f, 16.0f));
@ -8224,7 +8225,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
if (!selected_entry->dbentry->genre.empty()) if (!selected_entry->dbentry->genre.empty())
{ {
ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight);
ImGui::TextUnformatted(FSUI_CSTR("Genre: ")); ImGuiFullscreen::TextUnformatted(FSUI_ICONVSTR(ICON_EMOJI_BOOKS, FSUI_VSTR("Genre: ")));
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color); ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color);
@ -8236,7 +8237,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
if (selected_entry->dbentry->release_date != 0) if (selected_entry->dbentry->release_date != 0)
{ {
ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight);
ImGui::TextUnformatted(FSUI_CSTR("Release Date: ")); ImGuiFullscreen::TextUnformatted(FSUI_ICONVSTR(ICON_EMOJI_CALENDAR, FSUI_VSTR("Release Date: ")));
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color); ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color);
@ -8249,7 +8250,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
if (selected_entry->num_achievements > 0) if (selected_entry->num_achievements > 0)
{ {
ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight);
ImGui::TextUnformatted(FSUI_CSTR("Achievements: ")); ImGuiFullscreen::TextUnformatted(FSUI_ICONVSTR(ICON_EMOJI_TROPHY, "Achievements: "));
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color); ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color);
@ -8267,7 +8268,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
// compatibility // compatibility
ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight);
ImGui::TextUnformatted(FSUI_CSTR("Compatibility: ")); ImGuiFullscreen::TextUnformatted(FSUI_ICONSTR(ICON_EMOJI_STAR, FSUI_VSTR("Compatibility: ")));
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::Image(GetCachedTexture(selected_entry->GetCompatibilityIconFileName(), 88, 16), LayoutScale(88.0f, 16.0f)); ImGui::Image(GetCachedTexture(selected_entry->GetCompatibilityIconFileName(), 88, 16), LayoutScale(88.0f, 16.0f));
@ -8280,14 +8281,14 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
// play time // play time
ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight);
ImGui::TextUnformatted(FSUI_CSTR("Time Played: ")); ImGuiFullscreen::TextUnformatted(FSUI_ICONSTR(ICON_EMOJI_HOURGLASS, FSUI_VSTR("Time Played: ")));
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color); ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color);
ImGui::TextUnformatted(GameList::FormatTimespan(selected_entry->total_played_time).c_str()); ImGui::TextUnformatted(GameList::FormatTimespan(selected_entry->total_played_time).c_str());
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight);
ImGui::TextUnformatted(FSUI_CSTR("Last Played: ")); ImGuiFullscreen::TextUnformatted(FSUI_ICONSTR(ICON_EMOJI_CLOCK_FIVE_OCLOCK, FSUI_CSTR("Last Played: ")));
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color); ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color);
@ -8298,7 +8299,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
if (selected_entry->file_size >= 0) if (selected_entry->file_size >= 0)
{ {
ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight);
ImGui::TextUnformatted(FSUI_CSTR("File Size: ")); ImGuiFullscreen::TextUnformatted(FSUI_ICONSTR(ICON_EMOJI_OPEN_THE_FOLDER, FSUI_VSTR("File Size: ")));
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color); ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color);

View File

@ -1796,6 +1796,11 @@ void ImGuiFullscreen::TextAlignedMultiLine(float align_x, const char* text, cons
ImGui::ItemAdd(bb, 0); ImGui::ItemAdd(bb, 0);
} }
void ImGuiFullscreen::TextUnformatted(std::string_view text)
{
ImGui::TextUnformatted(IMSTR_START_END(text));
}
void ImGuiFullscreen::MenuHeading(std::string_view title, bool draw_line /*= true*/) void ImGuiFullscreen::MenuHeading(std::string_view title, bool draw_line /*= true*/)
{ {
const float line_thickness = draw_line ? LayoutScale(1.0f) : 0.0f; const float line_thickness = draw_line ? LayoutScale(1.0f) : 0.0f;

View File

@ -303,6 +303,7 @@ void RenderAutoLabelText(ImDrawList* draw_list, ImFont* font, float font_size, f
const ImVec2& pos_min, const ImVec2& pos_max, u32 color, std::string_view text, const ImVec2& pos_min, const ImVec2& pos_max, u32 color, std::string_view text,
char separator = ':', float shadow_offset = LayoutScale(LAYOUT_SHADOW_OFFSET)); char separator = ':', float shadow_offset = LayoutScale(LAYOUT_SHADOW_OFFSET));
void TextAlignedMultiLine(float align_x, const char* text, const char* text_end = nullptr, float wrap_width = -1.0f); void TextAlignedMultiLine(float align_x, const char* text, const char* text_end = nullptr, float wrap_width = -1.0f);
void TextUnformatted(std::string_view text);
void MenuHeading(std::string_view title, bool draw_line = true); void MenuHeading(std::string_view title, bool draw_line = true);
bool MenuHeadingButton(std::string_view title, std::string_view value = {}, bool enabled = true, bool draw_line = true); bool MenuHeadingButton(std::string_view title, std::string_view value = {}, bool enabled = true, bool draw_line = true);
bool MenuButton(std::string_view title, std::string_view summary, bool enabled = true, bool MenuButton(std::string_view title, std::string_view summary, bool enabled = true,