diff --git a/CMakeLists.txt b/CMakeLists.txt index 7097426..5c47fed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ endif() target_include_directories(${PROJECT_NAME} PRIVATE ${DIR_SOURCES}) # Flags de compilació per-target -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>) # Añadir definiciones de compilación dependiendo del tipo de build @@ -260,7 +260,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/animatedsprite.cpp b/source/core/rendering/animatedsprite.cpp index 1425e68..b642368 100644 --- a/source/core/rendering/animatedsprite.cpp +++ b/source/core/rendering/animatedsprite.cpp @@ -351,7 +351,7 @@ void AnimatedSprite::update(float dt_s) { } // Establece el rectangulo para un frame de una animación -void AnimatedSprite::setAnimationFrames(Uint8 index_animation, Uint8 index_frame, int x, int y, int w, int h) { +void AnimatedSprite::setAnimationFrames(Uint8 index_animation, Uint8 /*index_frame*/, int x, int y, int w, int h) { animation_[index_animation].frames.push_back({x, y, w, h}); } diff --git a/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp b/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp index ccc9337..bd7e353 100644 --- a/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp +++ b/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp @@ -79,7 +79,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_; } @@ -153,8 +153,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/resources/asset.h b/source/core/resources/asset.h index e7f44d1..6e0c1b8 100644 --- a/source/core/resources/asset.h +++ b/source/core/resources/asset.h @@ -1,5 +1,6 @@ #pragma once +#include // for size_t #include // for uint8_t #include // for string, basic_string #include // for vector @@ -41,7 +42,7 @@ class Asset { private: // Variables - int longest_name_{0}; // Contiene la longitud del nombre de fichero mas largo + std::size_t longest_name_{0}; // Contiene la longitud del nombre de fichero mas largo std::vector file_list_; // Listado con todas las rutas a los ficheros std::string executable_path_; // Ruta al ejecutable bool verbose_{true}; // Indica si ha de mostrar información por pantalla diff --git a/source/core/system/director.cpp b/source/core/system/director.cpp index 5fec770..1b9ab73 100644 --- a/source/core/system/director.cpp +++ b/source/core/system/director.cpp @@ -496,7 +496,7 @@ void Director::createSystemFolder(const std::string &folder) { // En Emscripten no necesitamos crear carpetas (MEMFS las crea automáticamente) (void)folder; #else - 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/scenes/intro.cpp b/source/game/scenes/intro.cpp index 605d567..0aa3082 100644 --- a/source/game/scenes/intro.cpp +++ b/source/game/scenes/intro.cpp @@ -412,6 +412,6 @@ void Intro::iterate() { } // Procesa un evento individual -void Intro::handleEvent(const SDL_Event *event) { +void Intro::handleEvent(const SDL_Event * /*event*/) { // SDL_EVENT_QUIT ya lo maneja Director } diff --git a/source/game/scenes/logo.cpp b/source/game/scenes/logo.cpp index d271909..877e3f5 100644 --- a/source/game/scenes/logo.cpp +++ b/source/game/scenes/logo.cpp @@ -125,6 +125,6 @@ void Logo::iterate() { } // Procesa un evento individual -void Logo::handleEvent(const SDL_Event *event) { +void Logo::handleEvent(const SDL_Event * /*event*/) { // SDL_EVENT_QUIT ya lo maneja Director } diff --git a/source/main.cpp b/source/main.cpp index 09bb255..960c34c 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -58,6 +58,6 @@ auto SDL_AppEvent(void *appstate, SDL_Event *event) -> SDL_AppResult { return static_cast(appstate)->handleEvent(event); } -void SDL_AppQuit(void *appstate, SDL_AppResult result) { +void SDL_AppQuit(void *appstate, SDL_AppResult /*result*/) { delete static_cast(appstate); }