void ScoreLoopThread::SubmitScore(AppData_t *app, double result, unsigned int mode) { qDebug() << "Submitting score " << result; /* Create a ScoreController */ SC_Error_t rc = SC_Client_CreateScoreController(app->client, &app->scoreController, SubmitScoreCompletionCallback, app); if (rc != SC_OK) { HandleError(app, rc); return; } /* Create and configure the score */ rc = SC_Client_CreateScore(app->client, &app->score); if (rc != SC_OK) { SC_ScoreController_Release(app->scoreController); /* Cleanup Controller */ HandleError(app, rc); return; } SC_Score_SetLevel(app->score, result); SC_Score_SetResult(app->score, result * 100); SC_Score_SetMode(app->score, mode); /* Submit the score */ rc = SC_ScoreController_SubmitScore(app->scoreController, app->score); if (rc != SC_OK) { SC_ScoreController_Release(app->scoreController); /* Cleanup Controller */ SC_Score_Release(app->score); /* Cleanup Score */ HandleError(app, rc); return; } qDebug() << "Submitting Score..."; }
CScores::CScores(): CBaseScene() { m_listview = 0; // Creating Scoreloop Controllers SC_Error_t retCode = SC_Client_CreateScoresController(g_client, &m_scoresController, ScoresControllerCallback, this); if (retCode != SC_OK) { m_scoresController = NULL; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_ScoresController"); } SC_Client_CreateScoreController(g_client, &m_scoreController, ScoreControllerCallbackSubmit, this); if (retCode != SC_OK) { m_scoreController = NULL; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_ScoreController"); } SC_Client_CreateRankingController(g_client, &m_rankingController, RankingControllerCallback, this); if (retCode != SC_OK) { m_rankingController = NULL; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_RankingController"); } SC_Client_CreateUserController(g_client, &m_userController, UserControllerCallback, this); if (retCode != SC_OK) { m_userController = NULL; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_UserController"); } }