highscore fixes
This commit is contained in:
@ -1232,13 +1232,25 @@ void ApplicationManager::setupStateHandlers() {
|
||||
// "GAME OVER" title
|
||||
font.draw(renderer.getSDLRenderer(), LOGICAL_W * 0.5f - 120, 140, "GAME OVER", 3.0f, {255, 80, 60, 255});
|
||||
|
||||
// Game stats
|
||||
// Game stats (single-player or coop combined)
|
||||
char buf[128];
|
||||
std::snprintf(buf, sizeof(buf), "SCORE %d LINES %d LEVEL %d",
|
||||
m_stateContext.game->score(),
|
||||
m_stateContext.game->lines(),
|
||||
m_stateContext.game->level());
|
||||
font.draw(renderer.getSDLRenderer(), LOGICAL_W * 0.5f - 180, 220, buf, 1.2f, {220, 220, 230, 255});
|
||||
if (m_stateContext.game && m_stateContext.game->getMode() == GameMode::Cooperate && m_stateContext.coopGame) {
|
||||
int leftScore = m_stateContext.coopGame->score(::CoopGame::PlayerSide::Left);
|
||||
int rightScore = m_stateContext.coopGame->score(::CoopGame::PlayerSide::Right);
|
||||
int total = leftScore + rightScore;
|
||||
std::snprintf(buf, sizeof(buf), "SCORE %d + %d = %d LINES %d LEVEL %d",
|
||||
leftScore,
|
||||
rightScore,
|
||||
total,
|
||||
m_stateContext.coopGame->lines(),
|
||||
m_stateContext.coopGame->level());
|
||||
} else {
|
||||
std::snprintf(buf, sizeof(buf), "SCORE %d LINES %d LEVEL %d",
|
||||
m_stateContext.game ? m_stateContext.game->score() : 0,
|
||||
m_stateContext.game ? m_stateContext.game->lines() : 0,
|
||||
m_stateContext.game ? m_stateContext.game->level() : 0);
|
||||
}
|
||||
font.draw(renderer.getSDLRenderer(), LOGICAL_W * 0.5f - 220, 220, buf, 1.2f, {220, 220, 230, 255});
|
||||
|
||||
// Instructions
|
||||
font.draw(renderer.getSDLRenderer(), LOGICAL_W * 0.5f - 120, 270, "PRESS ENTER / SPACE", 1.2f, {200, 200, 220, 255});
|
||||
|
||||
Reference in New Issue
Block a user