void Asteroids::OnScoreChanged(int score)
{
std::ostringstream msg_stream;
std::ostringstream msg_stream2;
std::ostringstream msg_stream3;
msg_stream << "Score: " << score;
msg_stream2 << "You scored: " << score;
msg_stream3 << "diff score: " << score;
// Get the score message as a string
std::string score_msg1 = msg_stream.str();
std::string score_msg2 = msg_stream2.str();
std::string score_msg3 = msg_stream3.str();
mScoreLabel->SetText(score_msg1);
// need the value of score_msg2 below outside the if statement
if (count == 1) {
mTempLabel->SetText(score_msg2);
}
//and display it here when count = 2 but it changes when count increments
if (count == 2) {
//attempt to display score when count = 1
mTempLabel2->SetText(score_msg2);
mTempLabel2->SetText(score_msg3);
}
}
I want to save the value of 'score' integer only when count = 1, and display it when count = 2, the problem is the value of 'score' changes when count = 2 and so the value of score is different when count = 1, how might i save or caputure the value of 'score' when count = 1 and display it outside the If statement (or anywhere else) before it changes
Aucun commentaire:
Enregistrer un commentaire