Añadido un define para poder pausar el juego y hacer capturas de pantalla
This commit is contained in:
2
Makefile
2
Makefile
@@ -19,7 +19,7 @@ windows:
|
||||
|
||||
windows_debug:
|
||||
@echo off
|
||||
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lmingw32 -lws2_32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(executable)_debug.exe"
|
||||
g++ $(source) -D DEBUG -D PAUSE -std=c++11 -Wall -Os -lmingw32 -lws2_32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(executable)_debug.exe"
|
||||
strip -s -R .comment -R .gnu.version "$(executable)_debug.exe" --strip-unneeded
|
||||
|
||||
windows_release:
|
||||
|
||||
@@ -16,7 +16,11 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
||||
// Pasa variables
|
||||
this->demo.enabled = demo;
|
||||
this->numPlayers = numPlayers;
|
||||
#ifdef PAUSE
|
||||
this->currentStage = 3;
|
||||
#else
|
||||
this->currentStage = currentStage;
|
||||
#endif
|
||||
lastStageReached = currentStage;
|
||||
if (numPlayers == 1)
|
||||
{ // Si solo juega un jugador, permite jugar tanto con teclado como con mando
|
||||
@@ -57,6 +61,9 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
||||
|
||||
// Inicializa las variables necesarias para la sección 'Game'
|
||||
init();
|
||||
#ifdef PAUSE
|
||||
pause = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
@@ -3367,8 +3374,13 @@ void Game::run()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PAUSE
|
||||
if (!pause)
|
||||
update();
|
||||
#else
|
||||
// Actualiza la lógica del juego
|
||||
update();
|
||||
#endif
|
||||
|
||||
// Comprueba los eventos que hay en cola
|
||||
checkEvents();
|
||||
@@ -3869,6 +3881,16 @@ void Game::checkEvents()
|
||||
section->subsection = SUBSECTION_GAME_PAUSE;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PAUSE
|
||||
else if (eventHandler->type == SDL_KEYDOWN)
|
||||
{
|
||||
if (eventHandler->key.keysym.scancode == SDL_SCANCODE_P)
|
||||
{
|
||||
pause = !pause;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -238,6 +238,9 @@ private:
|
||||
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
|
||||
#ifdef PAUSE
|
||||
bool pause;
|
||||
#endif
|
||||
|
||||
// Actualiza el juego
|
||||
void update();
|
||||
|
||||
Reference in New Issue
Block a user