From 59671d6e554713e39ae1927716f88aacfe555584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Sun, 30 Jun 2024 23:01:55 +0200 Subject: [PATCH] En el titulo no se podia empezar a jugar si no era con mando --- source/director.cpp | 1 - source/game.cpp | 2 +- source/main.cpp | 5 ++--- source/title.cpp | 15 +++++++++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/source/director.cpp b/source/director.cpp index 0d6e9bf..92cf075 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -87,7 +87,6 @@ void Director::initInput() { // Establece si ha de mostrar mensajes input->setVerbose(options->console); - input->setVerbose(true); // Busca si hay un mando conectado input->discoverGameController(); diff --git a/source/game.cpp b/source/game.cpp index dd2bb10..896a665 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -17,7 +17,6 @@ Game::Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *scree // Pasa variables this->demo.enabled = demo; - this->numPlayers = numPlayers; this->currentStage = currentStage; lastStageReached = currentStage; difficulty = options->game.difficulty; @@ -175,6 +174,7 @@ void Game::init(int playerID) Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures[1], playerAnimations); players.push_back(player2); + numPlayers = 2; diff --git a/source/main.cpp b/source/main.cpp index 59c5640..73fa15e 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -44,8 +44,7 @@ Reescribiendo el código el 27/09/2022 int main(int argc, char *argv[]) { - std::cout << "Starting the game..." << std::endl - << std::endl; + std::cout << "Game start" << std::endl; // Crea el objeto Director Director *director = new Director(argc, argv); @@ -56,7 +55,7 @@ int main(int argc, char *argv[]) // Destruye el objeto Director delete director; - std::cout << "\nShutting down the game..." << std::endl; + std::cout << "\nGame end" << std::endl; return 0; } diff --git a/source/title.cpp b/source/title.cpp index 2d34e9c..52b0f0f 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -235,8 +235,19 @@ void Title::checkInput() } } - // Comprueba solo el teclado - if (input->checkInput(input_window_fullscreen, REPEAT_FALSE)) + // Comprueba el teclado + if (input->checkInput(input_exit, REPEAT_FALSE)) + { + section->name = SECTION_PROG_QUIT; + } + + else if (input->checkInput(input_accept, REPEAT_FALSE)) + { + fade->activate(); + postFade = 0; + } + + else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE)) { screen->switchVideoMode(); }