supabase integration instead firebase

This commit is contained in:
2025-12-21 20:50:44 +01:00
parent 50c869536d
commit 494f906435
6 changed files with 221 additions and 85 deletions

View File

@ -813,11 +813,16 @@ void MenuState::render(SDL_Renderer* renderer, float logicalScale, SDL_Rect logi
}
static const std::vector<ScoreEntry> EMPTY_SCORES;
const auto& hs = ctx.scores ? ctx.scores->all() : EMPTY_SCORES;
// Filter highscores to show only classic gameplay entries on the main menu
// Choose which game_type to show based on current menu selection
std::string wantedType = "classic";
if (selectedButton == 0) wantedType = "classic"; // Play / Endless
else if (selectedButton == 1) wantedType = "cooperate"; // Coop
else if (selectedButton == 2) wantedType = "challenge"; // Challenge
// Filter highscores to the desired game type
std::vector<ScoreEntry> filtered;
filtered.reserve(hs.size());
for (const auto &e : hs) {
if (e.gameType == "classic") filtered.push_back(e);
if (e.gameType == wantedType) filtered.push_back(e);
}
size_t maxDisplay = std::min(filtered.size(), size_t(10)); // display only top 10