activa -Wextra -Wpedantic i neteja warnings

This commit is contained in:
2026-05-18 21:53:32 +02:00
parent 78682b7071
commit e47bc5188a
8 changed files with 45 additions and 13 deletions
+2 -2
View File
@@ -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 $<$<CONFIG:RELEASE>:-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/*")
+1 -1
View File
@@ -159,7 +159,7 @@ namespace GIF {
return data;
}
auto Gif::processImageDescriptor(const uint8_t*& buffer, const std::vector<RGB>& gct, int resolution_bits) -> std::vector<uint8_t> {
auto Gif::processImageDescriptor(const uint8_t*& buffer, const std::vector<RGB>& /*gct*/, int /*resolution_bits*/) -> std::vector<uint8_t> {
ImageDescriptor image_descriptor;
// Lee 9 bytes para el image descriptor.
readBytes(buffer, &image_descriptor, sizeof(ImageDescriptor));
@@ -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
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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_);
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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