From e47bc5188a4a41636fbf87ba40ae1a49130033f3 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Mon, 18 May 2026 21:53:32 +0200 Subject: [PATCH] activa -Wextra -Wpedantic i neteja warnings --- CMakeLists.txt | 4 +- source/core/rendering/gif.cpp | 2 +- .../core/rendering/sdl3gpu/sdl3gpu_shader.hpp | 38 +++++++++++++++++-- source/core/system/director.cpp | 4 +- source/game/gameplay/tilemap_renderer.cpp | 2 +- source/game/scenes/loading_screen.cpp | 4 +- source/game/scenes/logo.cpp | 2 +- source/game/scenes/title.cpp | 2 +- 8 files changed, 45 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9dc77e..d838a51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -244,7 +244,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3) # --- 4. CONFIGURACIÓN PLATAFORMAS Y COMPILADOR --- # Configuración de flags de compilación -target_compile_options(${PROJECT_NAME} PRIVATE -Wall) +target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic) target_compile_options(${PROJECT_NAME} PRIVATE $<$:-Os -ffunction-sections -fdata-sections>) # Definir _DEBUG en modo Debug y RELEASE_BUILD en modo Release @@ -390,7 +390,7 @@ if(NOT EMSCRIPTEN) source/core/resources/resource_pack.cpp ) target_include_directories(pack_resources PRIVATE "${CMAKE_SOURCE_DIR}/source") - target_compile_options(pack_resources PRIVATE -Wall) + target_compile_options(pack_resources PRIVATE -Wall -Wextra -Wpedantic) # Regeneració automàtica de resources.pack en cada build si canvia data/. file(GLOB_RECURSE DATA_FILES CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/data/*") diff --git a/source/core/rendering/gif.cpp b/source/core/rendering/gif.cpp index 6fac8f2..072a202 100644 --- a/source/core/rendering/gif.cpp +++ b/source/core/rendering/gif.cpp @@ -159,7 +159,7 @@ namespace GIF { return data; } - auto Gif::processImageDescriptor(const uint8_t*& buffer, const std::vector& gct, int resolution_bits) -> std::vector { + auto Gif::processImageDescriptor(const uint8_t*& buffer, const std::vector& /*gct*/, int /*resolution_bits*/) -> std::vector { ImageDescriptor image_descriptor; // Lee 9 bytes para el image descriptor. readBytes(buffer, &image_descriptor, sizeof(ImageDescriptor)); diff --git a/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp b/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp index 8dfcafb..28a55a9 100644 --- a/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp +++ b/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp @@ -77,7 +77,7 @@ namespace Rendering { const std::string& fragment_source) -> bool override; void render() override; - void setTextureSize(float width, float height) override {} + void setTextureSize(float /*width*/, float /*height*/) override {} void cleanup() final; // Libera pipeline/texturas pero mantiene el device vivo void destroy(); // Limpieza completa (device + swapchain); llamar solo al cerrar [[nodiscard]] auto isHardwareAccelerated() const -> bool override { return is_initialized_; } @@ -151,8 +151,40 @@ namespace Rendering { SDL_GPUTransferBuffer* upload_buffer_ = nullptr; SDL_GPUSampler* sampler_ = nullptr; // NEAREST - PostFXUniforms uniforms_{.vignette_strength = 0.6F, .chroma_min = 0.15F, .scanline_strength = 0.7F, .screen_height = 192.0F, .pixel_scale = 1.0F, .chroma_max = 0.15F, .scan_dark_ratio = 0.333F, .scan_dark_floor = 0.42F, .scan_edge_soft = 1.0F}; - CrtPiUniforms crtpi_uniforms_{.scanline_weight = 6.0F, .scanline_gap_brightness = 0.12F, .bloom_factor = 3.5F, .input_gamma = 2.4F, .output_gamma = 2.2F, .mask_brightness = 0.80F, .curvature_x = 0.05F, .curvature_y = 0.10F, .mask_type = 2, .enable_scanlines = 1, .enable_multisample = 1, .enable_gamma = 1}; + PostFXUniforms uniforms_{ + .vignette_strength = 0.6F, + .chroma_min = 0.15F, + .scanline_strength = 0.7F, + .screen_height = 192.0F, + .mask_strength = 0.0F, + .gamma_strength = 0.0F, + .curvature = 0.0F, + .bleeding = 0.0F, + .pixel_scale = 1.0F, + .time = 0.0F, + .flicker = 0.0F, + .chroma_max = 0.15F, + .scan_dark_ratio = 0.333F, + .scan_dark_floor = 0.42F, + .scan_edge_soft = 1.0F, + .pad3 = 0.0F}; + CrtPiUniforms crtpi_uniforms_{ + .scanline_weight = 6.0F, + .scanline_gap_brightness = 0.12F, + .bloom_factor = 3.5F, + .input_gamma = 2.4F, + .output_gamma = 2.2F, + .mask_brightness = 0.80F, + .curvature_x = 0.05F, + .curvature_y = 0.10F, + .mask_type = 2, + .enable_scanlines = 1, + .enable_multisample = 1, + .enable_gamma = 1, + .enable_curvature = 0, + .enable_sharper = 0, + .texture_width = 0.0F, + .texture_height = 0.0F}; ShaderType active_shader_ = ShaderType::POSTFX; // Shader de post-procesado activo int game_width_ = 0; // Dimensiones originales del canvas diff --git a/source/core/system/director.cpp b/source/core/system/director.cpp index 722550e..23c2234 100644 --- a/source/core/system/director.cpp +++ b/source/core/system/director.cpp @@ -72,7 +72,7 @@ Director::Director() // Crea el subdirectorio shaders/ dentro de system_folder_ sin modificar system_folder_ { std::string shaders_dir = system_folder_ + "/shaders"; - struct stat st = {.st_dev = 0}; + struct stat st{}; if (stat(shaders_dir.c_str(), &st) == -1) { errno = 0; #ifdef _WIN32 @@ -319,7 +319,7 @@ void Director::createSystemFolder(const std::string& folder) { } #endif - struct stat st = {.st_dev = 0}; + struct stat st{}; if (stat(system_folder_.c_str(), &st) == -1) { errno = 0; #ifdef _WIN32 diff --git a/source/game/gameplay/tilemap_renderer.cpp b/source/game/gameplay/tilemap_renderer.cpp index f171731..9d72c7f 100644 --- a/source/game/gameplay/tilemap_renderer.cpp +++ b/source/game/gameplay/tilemap_renderer.cpp @@ -133,7 +133,7 @@ void TilemapRenderer::setTile(int index, int tile_value) { #endif // Pinta el mapa estático y debug lines -void TilemapRenderer::fillMapTexture(const CollisionMap* collision_map) { +void TilemapRenderer::fillMapTexture(const CollisionMap* /*collision_map*/) { const Uint8 COLOR = stringToColor(bg_color_); auto previous_renderer = Screen::get()->getRendererSurface(); Screen::get()->setRendererSurface(map_surface_); diff --git a/source/game/scenes/loading_screen.cpp b/source/game/scenes/loading_screen.cpp index d9c8f2f..735cd8c 100644 --- a/source/game/scenes/loading_screen.cpp +++ b/source/game/scenes/loading_screen.cpp @@ -181,7 +181,7 @@ void LoadingScreen::updateState(float delta_time) { } // Gestiona la carga monocromática (time-based simplificado) -void LoadingScreen::updateMonoLoad(float delta_time) { +void LoadingScreen::updateMonoLoad(float /*delta_time*/) { // Calcular progreso lineal (0.0 - 1.0) float progress = state_time_ / LOADING_MONO_DURATION; progress = std::min(progress, 1.0F); @@ -234,7 +234,7 @@ void LoadingScreen::updateMonoLoad(float delta_time) { } // Gestiona la carga en color -void LoadingScreen::updateColorLoad(float delta_time) { +void LoadingScreen::updateColorLoad(float /*delta_time*/) { // Calcular progreso lineal (0.0 - 1.0) float progress = state_time_ / LOADING_COLOR_DURATION; progress = std::min(progress, 1.0F); diff --git a/source/game/scenes/logo.cpp b/source/game/scenes/logo.cpp index 926defb..1e8e832 100644 --- a/source/game/scenes/logo.cpp +++ b/source/game/scenes/logo.cpp @@ -66,7 +66,7 @@ void Logo::handleInput() { } // Gestiona el logo de JAILGAME -void Logo::updateJAILGAMES(float delta_time) { +void Logo::updateJAILGAMES(float /*delta_time*/) { // Solo actualizar durante el estado JAILGAMES_SLIDE_IN if (state_ != State::JAILGAMES_SLIDE_IN) { return; diff --git a/source/game/scenes/title.cpp b/source/game/scenes/title.cpp index d59344e..1b6ab91 100644 --- a/source/game/scenes/title.cpp +++ b/source/game/scenes/title.cpp @@ -164,7 +164,7 @@ void Title::handleMainMenuKeyPress(SDL_Keycode key) { } // Comprueba las entradas -void Title::handleInput(float delta_time) { +void Title::handleInput(float /*delta_time*/) { Input::get()->update(); // Permitir cancelar remap con ESC/CANCEL