Fade from main menu to gameplay

This commit is contained in:
2025-11-22 20:18:00 +01:00
parent c0bee9296a
commit 3c3a85d6d4
7 changed files with 167 additions and 17 deletions

View File

@ -124,7 +124,8 @@ void GameRenderer::renderPlayingState(
float winW,
float winH,
bool showExitConfirmPopup,
int exitPopupSelectedButton
int exitPopupSelectedButton,
bool suppressPauseVisuals
) {
if (!game || !pixelFont) return;
@ -237,8 +238,10 @@ void GameRenderer::renderPlayingState(
}
}
bool allowActivePieceRender = !game->isPaused() || suppressPauseVisuals;
// Draw ghost piece (where current piece will land)
if (!game->isPaused()) {
if (allowActivePieceRender) {
Game::Piece ghostPiece = game->current();
// Find landing position
while (true) {
@ -271,7 +274,7 @@ void GameRenderer::renderPlayingState(
}
// Draw the falling piece
if (!game->isPaused()) {
if (allowActivePieceRender) {
drawPiece(renderer, blocksTex, game->current(), gridX, gridY, finalBlockSize, false);
}
@ -413,8 +416,8 @@ void GameRenderer::renderPlayingState(
drawSmallPiece(renderer, blocksTex, static_cast<PieceType>(game->held().type), statsX + 60, statsY + statsH - 80, finalBlockSize * 0.6f);
}
// Pause overlay
if (game->isPaused() && !showExitConfirmPopup) {
// Pause overlay (skip when visuals are suppressed, e.g., countdown)
if (!suppressPauseVisuals && game->isPaused() && !showExitConfirmPopup) {
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 180);
SDL_FRect pauseOverlay{0, 0, logicalW, logicalH};
SDL_RenderFillRect(renderer, &pauseOverlay);