mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
Achievements: Open cheevo details in browser when selected
This commit is contained in:
parent
da9e3064c2
commit
eae4f73f94
|
@ -65,6 +65,7 @@ namespace Achievements {
|
|||
static constexpr const char* INFO_SOUND_NAME = "sounds/achievements/message.wav";
|
||||
static constexpr const char* UNLOCK_SOUND_NAME = "sounds/achievements/unlock.wav";
|
||||
static constexpr const char* LBSUBMIT_SOUND_NAME = "sounds/achievements/lbsubmit.wav";
|
||||
static constexpr const char* ACHEIVEMENT_DETAILS_URL_TEMPLATE = "https://retroachievements.org/achievement/{}";
|
||||
|
||||
static constexpr u32 LEADERBOARD_NEARBY_ENTRIES_TO_FETCH = 10;
|
||||
static constexpr u32 LEADERBOARD_ALL_FETCH_SIZE = 20;
|
||||
|
@ -2310,10 +2311,10 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
|||
|
||||
ImRect bb;
|
||||
bool visible, hovered;
|
||||
ImGuiFullscreen::MenuButtonFrame(TinyString::from_format("chv_{}", cheevo->id), true,
|
||||
const bool clicked = ImGuiFullscreen::MenuButtonFrame(
|
||||
TinyString::from_format("chv_{}", cheevo->id), true,
|
||||
!is_measured ? ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT + unlock_size :
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT +
|
||||
progress_height_unscaled + progress_spacing_unscaled,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT + progress_height_unscaled + progress_spacing_unscaled,
|
||||
&visible, &hovered, &bb.Min, &bb.Max, 0, alpha);
|
||||
if (!visible)
|
||||
return;
|
||||
|
@ -2433,6 +2434,14 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
|||
measured_progress.data() + measured_progress.size());
|
||||
}
|
||||
|
||||
if (clicked)
|
||||
{
|
||||
const SmallString url = SmallString::from_format(fmt::runtime(ACHEIVEMENT_DETAILS_URL_TEMPLATE), cheevo->id);
|
||||
Log_InfoFmt("Opening achievement details: {}", url);
|
||||
Host::OpenURL(url);
|
||||
}
|
||||
|
||||
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue