upodate game start and blur on pause

This commit is contained in:
2025-11-23 09:40:00 +01:00
parent 9a035df452
commit 5bf87f2c21
8 changed files with 350 additions and 177 deletions

View File

@ -729,7 +729,7 @@ int main(int, char **)
bool gameplayCountdownActive = false;
double gameplayCountdownElapsed = 0.0;
int gameplayCountdownIndex = 0;
const double GAMEPLAY_COUNTDOWN_STEP_MS = 600.0;
const double GAMEPLAY_COUNTDOWN_STEP_MS = 400.0;
const std::array<const char*, 4> GAMEPLAY_COUNTDOWN_LABELS = { "3", "2", "1", "START" };
// Instantiate state manager
@ -758,6 +758,8 @@ int main(int, char **)
ctx.showSettingsPopup = &showSettingsPopup;
ctx.showExitConfirmPopup = &showExitConfirmPopup;
ctx.exitPopupSelectedButton = &exitPopupSelectedButton;
ctx.gameplayCountdownActive = &gameplayCountdownActive;
ctx.menuPlayCountdownArmed = &menuPlayCountdownArmed;
ctx.playerName = &playerName;
ctx.fullscreenFlag = &isFullscreen;
ctx.applyFullscreen = [window, &isFullscreen](bool enable) {
@ -1505,21 +1507,7 @@ int main(int, char **)
}
break;
case AppState::Playing:
GameRenderer::renderPlayingState(
renderer,
&game,
&pixelFont,
&lineEffect,
blocksTex,
(float)LOGICAL_W,
(float)LOGICAL_H,
logicalScale,
(float)winW,
(float)winH,
showExitConfirmPopup,
exitPopupSelectedButton,
(gameplayCountdownActive || menuPlayCountdownArmed)
);
playingState->render(renderer, logicalScale, logicalVP);
break;
case AppState::GameOver:
// Draw the game state in the background
@ -1533,8 +1521,7 @@ int main(int, char **)
(float)LOGICAL_H,
logicalScale,
(float)winW,
(float)winH,
false // No exit popup in Game Over
(float)winH
);
// Draw Game Over Overlay
@ -1662,9 +1649,10 @@ int main(int, char **)
SDL_SetRenderViewport(renderer, nullptr);
SDL_SetRenderScale(renderer, 1.f, 1.f);
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 160);
SDL_FRect dimRect{0.f, 0.f, (float)winW, (float)winH};
SDL_RenderFillRect(renderer, &dimRect);
// Removed background overlay for cleaner countdown
// SDL_SetRenderDrawColor(renderer, 0, 0, 0, 160);
// SDL_FRect dimRect{0.f, 0.f, (float)winW, (float)winH};
// SDL_RenderFillRect(renderer, &dimRect);
SDL_SetRenderViewport(renderer, &logicalVP);
SDL_SetRenderScale(renderer, logicalScale, logicalScale);