activa -Wextra -Wpedantic i neteja warnings

This commit is contained in:
2026-05-19 18:49:51 +02:00
parent 7bd4d4d114
commit be1a9a1d9b
8 changed files with 44 additions and 11 deletions
+2 -2
View File
@@ -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 $<$<CONFIG:RELEASE>:-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/*")
+1 -1
View File
@@ -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});
}
@@ -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
+2 -1
View File
@@ -1,5 +1,6 @@
#pragma once
#include <cstddef> // for size_t
#include <cstdint> // for uint8_t
#include <string> // for string, basic_string
#include <vector> // 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<Item> 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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
}
+1 -1
View File
@@ -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
}
+1 -1
View File
@@ -58,6 +58,6 @@ auto SDL_AppEvent(void *appstate, SDL_Event *event) -> SDL_AppResult {
return static_cast<Director *>(appstate)->handleEvent(event);
}
void SDL_AppQuit(void *appstate, SDL_AppResult result) {
void SDL_AppQuit(void *appstate, SDL_AppResult /*result*/) {
delete static_cast<Director *>(appstate);
}