From 9e5f7c481e26046ca63d40c71fb6803b10b401e6 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 12 Mar 2026 00:56:31 -0700 Subject: [PATCH] Wire achievement toast and ding effect callbacks Level-up now calls triggerDing() (sound + emote + fade text) in addition to the screen flash. Achievement earned now calls triggerAchievementToast() via setAchievementEarnedCallback(), making the existing toast animation visible. --- include/ui/game_screen.hpp | 1 + src/ui/game_screen.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/ui/game_screen.hpp b/include/ui/game_screen.hpp index 660a25ec..a27f1808 100644 --- a/include/ui/game_screen.hpp +++ b/include/ui/game_screen.hpp @@ -371,6 +371,7 @@ private: std::vector chatBubbles_; bool chatBubbleCallbackSet_ = false; bool levelUpCallbackSet_ = false; + bool achievementCallbackSet_ = false; // Mail compose state char mailRecipientBuffer_[256] = ""; diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 408a1457..5acec3f6 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -214,10 +214,19 @@ void GameScreen::render(game::GameHandler& gameHandler) { gameHandler.setLevelUpCallback([this](uint32_t newLevel) { levelUpFlashAlpha_ = 1.0f; levelUpDisplayLevel_ = newLevel; + triggerDing(newLevel); }); levelUpCallbackSet_ = true; } + // Set up achievement toast callback (once) + if (!achievementCallbackSet_) { + gameHandler.setAchievementEarnedCallback([this](uint32_t id, const std::string& name) { + triggerAchievementToast(id, name); + }); + achievementCallbackSet_ = true; + } + // Apply UI transparency setting float prevAlpha = ImGui::GetStyle().Alpha; ImGui::GetStyle().Alpha = uiOpacity_;