Double check of scores API

Hello, I think this is right based on Scoreboard API - Playdate Help and the fact that this scores is the final member of the struct. But as I can only register my own high score during testing I would like to quickly double check that this is the expected interface pattern for when there are more than one! Thanks

void scoresCallback(PDScoresList* scoresList, const char* errorMessage) {
  // error handling here 
  for (uint32_t s = 0; s < scoresList->count; ++s) {
    const PDScore* score = scoresList->scores + s; // THIS LINE IS CORRECT?
    const uint32_t rankIndex = score->rank - 1; // Rank 1 is index 0
    strcpy(s_scoreNames[rankIndex], score->player);
    snprintf(s_scoreValues[rankIndex], 64, "%u", (unsigned) score->value);

Ok, this looks too be correct. The first player high score is in, and it's displaying as intended!

1 Like