From b90ac65cfcaff7d3f5945f8eab84ec4e2dbb695a Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sun, 27 Oct 2024 17:45:49 +0100 Subject: [PATCH] Eliminats warnings que nomes es veuen al compilar en macos/linux --- source/asset.cpp | 2 +- source/director.h | 2 ++ source/game.cpp | 22 +++++++++------------- source/title.cpp | 2 +- source/title.h | 11 +++++------ 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/source/asset.cpp b/source/asset.cpp index 1a5575b..b155608 100644 --- a/source/asset.cpp +++ b/source/asset.cpp @@ -40,7 +40,7 @@ void Asset::add(const std::string &file, AssetType type, bool required, bool abs std::string Asset::get(const std::string &text) const { auto it = std::find_if(file_list_.begin(), file_list_.end(), - [&text, this](const auto &f) + [&text](const auto &f) { return getFileName(f.file) == text; }); diff --git a/source/director.h b/source/director.h index 01ef0f5..10f3ef0 100644 --- a/source/director.h +++ b/source/director.h @@ -20,7 +20,9 @@ private: // Objetos y punteros SDL_Window *window_; // La ventana donde dibujamos SDL_Renderer *renderer_; // El renderizador de la ventana +#ifndef VERBOSE std::streambuf *orig_buf; // Puntero al buffer de flujo original para restaurar std::cout +#endif // Variables std::string executable_path_; // Path del ejecutable diff --git a/source/game.cpp b/source/game.cpp index a586b33..71f99ca 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1578,7 +1578,9 @@ void Game::updateScoreboard() void Game::pause(bool value) { paused_ = value; +#ifndef DEBUG screen_->attenuate(paused_); +#endif } // Añade una puntuación a la tabla de records @@ -1660,13 +1662,9 @@ void Game::checkInput() checkPauseInput(); // Verifica si se debe pausar el juego. if (demo_.enabled) - { handleDemoMode(); // Controla el comportamiento de los jugadores en modo demo. - } else - { handlePlayersInput(); // Gestiona el input normal de los jugadores. - } screen_->checkInput(); // Verifica el input en la pantalla del juego. globalInputs::check(); // Verifica los inputs globales. @@ -1675,13 +1673,19 @@ void Game::checkInput() // Verifica si alguno de los controladores ha solicitado una pausa y actualiza el estado de pausa del juego. void Game::checkPauseInput() { + // Comprueba los mandos for (int i = 0; i < input_->getNumControllers(); ++i) - { if (input_->checkModInput(InputType::SERVICE, InputType::PAUSE, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i)) { pause(!paused_); // Alterna entre pausado y no pausado. return; } + + // Comprueba el teclado + if (input_->checkInput(InputType::PAUSE, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD)) + { + pause(!paused_); // Alterna entre pausado y no pausado. + return; } } @@ -1692,9 +1696,7 @@ void Game::handleDemoMode() for (const auto &player : players_) { if (player->isPlaying()) - { handleDemoPlayerInput(player, i); // Maneja el input específico del jugador en modo demo. - } if (input_->checkAnyButtonPressed()) { section::name = section::Name::TITLE; // Salir del modo demo y regresar al menú principal. @@ -1743,17 +1745,11 @@ void Game::handlePlayersInput() for (const auto &player : players_) { if (player->isPlaying()) - { handleNormalPlayerInput(player); // Maneja el input de los jugadores en modo normal. - } else if (player->isContinue() || player->isWaiting()) - { handlePlayerContinue(player); // Gestiona la continuación del jugador. - } else if (player->isEnteringName()) - { handleNameInput(player); // Gestiona la introducción del nombre del jugador. - } } } diff --git a/source/title.cpp b/source/title.cpp index d7b979e..4e22afb 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -70,7 +70,7 @@ void Title::update() { if (post_fade_ == -1) { - section::name = section::Name::GAME_DEMO; + section::name = next_section_; } else { diff --git a/source/title.h b/source/title.h index 36667eb..93155c3 100644 --- a/source/title.h +++ b/source/title.h @@ -54,12 +54,11 @@ private: std::unique_ptr define_buttons_; // Objeto para definir los botones del joystic // Variable - int counter_ = 0; // Temporizador para la pantalla de titulo - Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa - bool demo_ = true; // Indica si el modo demo estará activo - section::Name next_section_ = section::Name::GAME; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo - int post_fade_ = 0; // Opción a realizar cuando termina el fundido - int num_controllers_; // Número de mandos conectados + int counter_ = 0; // Temporizador para la pantalla de titulo + Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa + section::Name next_section_ = section::Name::GAME_DEMO; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo + int post_fade_ = 0; // Opción a realizar cuando termina el fundido + int num_controllers_; // Número de mandos conectados // Actualiza las variables del objeto void update();