diff --git a/source/game.cpp b/source/game.cpp index d74b95f..6b0af6f 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -313,7 +313,7 @@ void Game::updateGameStateGameOver() if (game_over_counter_ == GAME_OVER_COUNTER_) { createMessage({paths_.at(2), paths_.at(3)}, Resource::get()->getTexture("game_text_game_over")); - /*JA_FadeOutMusic(1000);*/ + JA_FadeOutMusic(1000); balloon_manager_->setSounds(true); } diff --git a/source/logo.cpp b/source/logo.cpp index 081477f..8e3d413 100644 --- a/source/logo.cpp +++ b/source/logo.cpp @@ -185,7 +185,7 @@ void Logo::render() void Logo::run() { // Detiene la música - /*JA_FadeOutMusic(300);*/ + JA_FadeOutMusic(300); while (section::name == section::Name::LOGO) { diff --git a/source/options.cpp b/source/options.cpp index 8b811ad..f96eaef 100644 --- a/source/options.cpp +++ b/source/options.cpp @@ -1,12 +1,11 @@ #include "options.h" -#include // Para SDL_LogCategory, SDL_LogInfo, SDL_LogWarn +#include // Para SDL_LogCategory, SDL_LogInfo, SDL_LogError #include // Para clamp #include // Para basic_ostream, operator<<, basic_ostream::... #include // Para swap #include // Para vector #include "input.h" // Para InputDeviceToUse #include "lang.h" // Para Code -#include "screen.h" // Para ScreenFilter #include "utils.h" // Para boolToString, stringToBool, getFileName // Variables @@ -23,7 +22,7 @@ void initOptions() // Opciones de video options.video.fullscreen = false; - options.video.filter = ScreenFilter::NEAREST; + options.video.scale_mode = SDL_ScaleMode::SDL_SCALEMODE_NEAREST; options.video.v_sync = true; options.video.integer_scale = true; options.video.shaders = false; @@ -118,12 +117,12 @@ bool saveOptionsFile(std::string file_path) // Opciones de video file << "## VIDEO\n"; - file << "## video.filter [" << static_cast(ScreenFilter::NEAREST) << ": nearest, " << static_cast(ScreenFilter::LINEAL) << ": lineal]\n"; + file << "## video.scale_mode [" << static_cast(SDL_ScaleMode::SDL_SCALEMODE_NEAREST) << ": nearest, " << static_cast(SDL_ScaleMode::SDL_SCALEMODE_LINEAR) << ": lineal]\n"; file << "\n"; file << "window.zoom=" << options.window.zoom << "\n"; file << "video.fullscreen=" << boolToString(options.video.fullscreen) << "\n"; - file << "video.filter=" << static_cast(options.video.filter) << "\n"; + file << "video.scale_mode=" << static_cast(options.video.scale_mode) << "\n"; file << "video.v_sync=" << boolToString(options.video.v_sync) << "\n"; file << "video.integer_scale=" << boolToString(options.video.integer_scale) << "\n"; file << "video.shaders=" << boolToString(options.video.shaders) << "\n"; @@ -190,14 +189,10 @@ bool setOptions(const std::string &var, const std::string &value) else if (var == "window.zoom") { options.window.zoom = std::stoi(value); - if ((options.window.zoom < 1) || (options.window.zoom > 4)) - { - options.window.zoom = 3; - } } - else if (var == "video.filter") + else if (var == "video.scale_mode") { - options.video.filter = static_cast(std::stoi(value)); + options.video.scale_mode = static_cast(std::stoi(value)); } else if (var == "video.shaders") { diff --git a/source/options.h b/source/options.h index c059aeb..5de35bc 100644 --- a/source/options.h +++ b/source/options.h @@ -1,11 +1,11 @@ #pragma once #include // Para SDL_GamepadButton +#include // Para SDL_ScaleMode #include // Para string #include // Para vector #include "input.h" // Para InputAction, InputDeviceToUse #include "manage_hiscore_table.h" // Para HiScoreEntry -enum class ScreenFilter : int; // lines 8-8 namespace lang { enum class Code : int; @@ -30,12 +30,12 @@ struct WindowOptions // Estructura con opciones para el video struct VideoOptions { - ScreenFilter filter; // Filtro usado para el escalado de la imagen - bool fullscreen; // Contiene el valor del modo de pantalla completa - bool v_sync; // Indica si se quiere usar vsync o no - bool integer_scale; // Indica si se va a usar el escalado entero - bool shaders; // Indica si se van a usar shaders para los filtros de video - std::string info; // Información sobre el modo de video + SDL_ScaleMode scale_mode; // Filtro usado para el escalado de la imagen + bool fullscreen; // Contiene el valor del modo de pantalla completa + bool v_sync; // Indica si se quiere usar vsync o no + bool integer_scale; // Indica si se va a usar el escalado entero + bool shaders; // Indica si se van a usar shaders para los filtros de video + std::string info; // Información sobre el modo de video }; // Estructura para las opciones de musica diff --git a/source/screen.cpp b/source/screen.cpp index 4790a1e..89aab7c 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -317,12 +317,6 @@ bool Screen::initSDL() getDisplayInfo(); - // Establece el filtro de la textura - /*if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(static_cast(options.video.filter)).c_str())) - { - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Warning: texture filtering not enabled!"); - }*/ - if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl")) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Warning: opengl not enabled!"); diff --git a/source/screen.h b/source/screen.h index 8709955..2c710e8 100644 --- a/source/screen.h +++ b/source/screen.h @@ -9,12 +9,6 @@ #include "param.h" // Para Param, ParamGame, param #include "utils.h" // Para Color -enum class ScreenFilter : int -{ - NEAREST = 0, - LINEAL = 1, -}; - class Screen { private: diff --git a/source/utils.cpp b/source/utils.cpp index 9fe1f29..a38e507 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -302,28 +302,28 @@ bool stringInVector(const std::vector &vec, const std::string &str) // Imprime por pantalla una línea de texto de tamaño fijo rellena con puntos void printWithDots(const std::string &text1, const std::string &text2, const std::string &text3) { - const size_t TOTAL_WIDTH = 50; + constexpr size_t TOTAL_WIDTH = 52; // Calcula el ancho del campo para text2 restando la longitud de text1 y text3 - size_t fieldWidth = TOTAL_WIDTH > (text1.size() + text3.size()) + size_t field_width = TOTAL_WIDTH > (text1.size() + text3.size()) ? TOTAL_WIDTH - text1.size() - text3.size() : 0; // Prepara el bloque a imprimir a partir de text2 - std::string fieldText; - if (text2.size() < fieldWidth) + std::string field_text; + if (text2.size() < field_width) { // Si text2 es más corto, lo rellenamos a la derecha con puntos - fieldText = text2 + std::string(fieldWidth - text2.size(), '.'); + field_text = text2 + std::string(field_width - text2.size(), '.'); } else { // Si es demasiado largo, lo cortamos - fieldText = text2.substr(0, fieldWidth); + field_text = text2.substr(0, field_width); } // Concatena todo - std::string formatted_text = text1 + fieldText + text3; + std::string formatted_text = text1 + field_text + text3; // Imprime la línea formateada usando SDL_LogInfo SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%s", formatted_text.c_str());