aplanat sub-bucles anidats de pausa, game over, instruccions i demo (milestone 2)
- Game::runPausedGame() convertit a enterPausedGame() + despatx directe en run() - Game::runGameOverScreen() convertit a enterGameOverScreen() + despatx directe - Eliminada variable static postFade, convertida a membre gameOverPostFade - Extret SDL_PollEvent de updateGameOverScreen() a checkGameOverEvents() - Game::run() refactoritzat amb iterate() + hasFinished() per preparar callbacks - Title::runInstructions() i runDemoGame() convertits a no-bloquejants - Instructions ara usa finished/quitRequested en lloc de modificar section directament - Instructions exposa start(), update(), checkEvents(), render(), hasFinished() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -90,19 +90,22 @@ class Game {
|
||||
|
||||
// Estado para el efecto de agitación intensa (muerte del jugador)
|
||||
struct deathShake_t {
|
||||
bool active; // Indica si el efecto está activo
|
||||
Uint8 step; // Paso actual del efecto (0-7)
|
||||
Uint32 lastStepTicks; // Ticks del último paso
|
||||
bool active; // Indica si el efecto está activo
|
||||
Uint8 step; // Paso actual del efecto (0-7)
|
||||
Uint32 lastStepTicks; // Ticks del último paso
|
||||
};
|
||||
|
||||
// Fases de la secuencia de muerte del jugador
|
||||
enum class DeathPhase { None, Shaking, Waiting, Done };
|
||||
enum class DeathPhase { None,
|
||||
Shaking,
|
||||
Waiting,
|
||||
Done };
|
||||
|
||||
// Estado de la secuencia de muerte del jugador
|
||||
struct deathSequence_t {
|
||||
DeathPhase phase; // Fase actual
|
||||
Uint32 phaseStartTicks; // Ticks del inicio de la fase actual
|
||||
Player *player; // Jugador que está muriendo
|
||||
DeathPhase phase; // Fase actual
|
||||
Uint32 phaseStartTicks; // Ticks del inicio de la fase actual
|
||||
Player *player; // Jugador que está muriendo
|
||||
};
|
||||
|
||||
struct helper_t {
|
||||
@@ -252,6 +255,9 @@ class Game {
|
||||
int cloudsSpeed; // Velocidad a la que se desplazan las nubes
|
||||
int pauseCounter; // Contador para salir del menu de pausa y volver al juego
|
||||
bool leavingPauseMenu; // Indica si esta saliendo del menu de pausa para volver al juego
|
||||
bool pauseInitialized; // Indica si la pausa ha sido inicializada
|
||||
bool gameOverInitialized; // Indica si el game over ha sido inicializado
|
||||
int gameOverPostFade; // Opción a realizar cuando termina el fundido del game over
|
||||
#ifdef PAUSE
|
||||
bool pause;
|
||||
#endif
|
||||
@@ -496,8 +502,8 @@ class Game {
|
||||
// Dibuja el menu de pausa del juego
|
||||
void renderPausedGame();
|
||||
|
||||
// Bucle para el menu de pausa del juego
|
||||
void runPausedGame();
|
||||
// Inicializa el estado de pausa del juego
|
||||
void enterPausedGame();
|
||||
|
||||
// Actualiza los elementos de la pantalla de game over
|
||||
void updateGameOverScreen();
|
||||
@@ -505,8 +511,11 @@ class Game {
|
||||
// Dibuja los elementos de la pantalla de game over
|
||||
void renderGameOverScreen();
|
||||
|
||||
// Bucle para la pantalla de game over
|
||||
void runGameOverScreen();
|
||||
// Inicializa el estado de game over
|
||||
void enterGameOverScreen();
|
||||
|
||||
// Comprueba los eventos de la pantalla de game over
|
||||
void checkGameOverEvents();
|
||||
|
||||
// Indica si se puede crear una powerball
|
||||
bool canPowerBallBeCreated();
|
||||
@@ -547,4 +556,10 @@ class Game {
|
||||
|
||||
// Bucle para el juego
|
||||
void run();
|
||||
|
||||
// Ejecuta un frame del juego
|
||||
void iterate();
|
||||
|
||||
// Indica si el juego ha terminado
|
||||
bool hasFinished() const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user