activa -Wextra -Wpedantic i neteja warnings

This commit is contained in:
2026-05-18 22:36:01 +02:00
parent 5349c60c39
commit 02bc4de6d5
17 changed files with 80 additions and 38 deletions
+4 -4
View File
@@ -83,11 +83,11 @@ void Background::initializeSprites() {
const float TOP_CLOUDS_Y = base_ - 165;
const float BOTTOM_CLOUDS_Y = base_ - 101;
top_clouds_sprite_a_ = std::make_unique<MovingSprite>(top_clouds_texture_, (SDL_FRect){.x = 0, .y = TOP_CLOUDS_Y, .w = rect_.w, .h = static_cast<float>(top_clouds_texture_->getHeight())});
top_clouds_sprite_b_ = std::make_unique<MovingSprite>(top_clouds_texture_, (SDL_FRect){.x = rect_.w, .y = TOP_CLOUDS_Y, .w = rect_.w, .h = static_cast<float>(top_clouds_texture_->getHeight())});
top_clouds_sprite_a_ = std::make_unique<MovingSprite>(top_clouds_texture_, SDL_FRect{.x = 0, .y = TOP_CLOUDS_Y, .w = rect_.w, .h = static_cast<float>(top_clouds_texture_->getHeight())});
top_clouds_sprite_b_ = std::make_unique<MovingSprite>(top_clouds_texture_, SDL_FRect{.x = rect_.w, .y = TOP_CLOUDS_Y, .w = rect_.w, .h = static_cast<float>(top_clouds_texture_->getHeight())});
bottom_clouds_sprite_a_ = std::make_unique<MovingSprite>(bottom_clouds_texture_, (SDL_FRect){.x = 0, .y = BOTTOM_CLOUDS_Y, .w = rect_.w, .h = static_cast<float>(bottom_clouds_texture_->getHeight())});
bottom_clouds_sprite_b_ = std::make_unique<MovingSprite>(bottom_clouds_texture_, (SDL_FRect){.x = rect_.w, .y = BOTTOM_CLOUDS_Y, .w = rect_.w, .h = static_cast<float>(bottom_clouds_texture_->getHeight())});
bottom_clouds_sprite_a_ = std::make_unique<MovingSprite>(bottom_clouds_texture_, SDL_FRect{.x = 0, .y = BOTTOM_CLOUDS_Y, .w = rect_.w, .h = static_cast<float>(bottom_clouds_texture_->getHeight())});
bottom_clouds_sprite_b_ = std::make_unique<MovingSprite>(bottom_clouds_texture_, SDL_FRect{.x = rect_.w, .y = BOTTOM_CLOUDS_Y, .w = rect_.w, .h = static_cast<float>(bottom_clouds_texture_->getHeight())});
buildings_sprite_ = std::make_unique<Sprite>(buildings_texture_);
gradient_sprite_ = std::make_unique<Sprite>(gradients_texture_, 0, 0, rect_.w, rect_.h);
+1 -1
View File
@@ -68,7 +68,7 @@ void Fade::render() {
}
// Actualiza las variables internas
void Fade::update(float delta_time) {
void Fade::update(float /*delta_time*/) {
switch (state_) {
case State::PRE:
updatePreState();
+1 -1
View File
@@ -141,7 +141,7 @@ namespace GIF {
}
// Procesa el Image Descriptor y retorna el vector de datos sin comprimir.
auto processImageDescriptor(const uint8_t *&buffer, const std::vector<RGB> &gct, int resolution_bits) -> std::vector<uint8_t> {
auto processImageDescriptor(const uint8_t *&buffer, const std::vector<RGB> & /*gct*/, int /*resolution_bits*/) -> std::vector<uint8_t> {
ImageDescriptor image_descriptor;
readBytes(buffer, &image_descriptor, sizeof(ImageDescriptor));
@@ -72,7 +72,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;
void destroy();
[[nodiscard]] auto isHardwareAccelerated() const -> bool override { return is_initialized_; }
@@ -117,8 +117,40 @@ namespace Rendering {
SDL_GPUTransferBuffer* upload_buffer_ = nullptr;
SDL_GPUSampler* sampler_ = nullptr;
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;
int game_width_ = 0;
+3 -3
View File
@@ -8,13 +8,13 @@
// Constructor
Sprite::Sprite(std::shared_ptr<Texture> texture, float pos_x, float pos_y, float width, float height)
: textures_{std::move(texture)},
pos_((SDL_FRect){.x = pos_x, .y = pos_y, .w = width, .h = height}),
sprite_clip_((SDL_FRect){.x = 0, .y = 0, .w = pos_.w, .h = pos_.h}) {}
pos_(SDL_FRect{.x = pos_x, .y = pos_y, .w = width, .h = height}),
sprite_clip_(SDL_FRect{.x = 0, .y = 0, .w = pos_.w, .h = pos_.h}) {}
Sprite::Sprite(std::shared_ptr<Texture> texture, SDL_FRect rect)
: textures_{std::move(texture)},
pos_(rect),
sprite_clip_((SDL_FRect){.x = 0, .y = 0, .w = pos_.w, .h = pos_.h}) {}
sprite_clip_(SDL_FRect{.x = 0, .y = 0, .w = pos_.w, .h = pos_.h}) {}
Sprite::Sprite(std::shared_ptr<Texture> texture)
: textures_{std::move(texture)},
+8 -8
View File
@@ -32,7 +32,7 @@ Text::Text(const std::shared_ptr<Texture>& texture, const std::string& text_file
}
// Crea los objetos
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
sprite_ = std::make_unique<Sprite>(texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
// Inicializa variables
fixed_width_ = false;
@@ -50,7 +50,7 @@ Text::Text(const std::shared_ptr<Texture>& texture, const std::shared_ptr<Text::
}
// Crea los objetos
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
sprite_ = std::make_unique<Sprite>(texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
// Inicializa variables
fixed_width_ = false;
@@ -71,8 +71,8 @@ Text::Text(const std::shared_ptr<Texture>& texture, const std::shared_ptr<Textur
}
// Crea los objetos
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
white_sprite_ = std::make_unique<Sprite>(white_texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
sprite_ = std::make_unique<Sprite>(texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
white_sprite_ = std::make_unique<Sprite>(white_texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
// Inicializa variables
fixed_width_ = false;
@@ -90,8 +90,8 @@ Text::Text(const std::shared_ptr<Texture>& texture, const std::shared_ptr<Textur
}
// Crea los objetos
sprite_ = std::make_unique<Sprite>(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
white_sprite_ = std::make_unique<Sprite>(white_texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
sprite_ = std::make_unique<Sprite>(texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
white_sprite_ = std::make_unique<Sprite>(white_texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast<float>(box_width_), .h = static_cast<float>(box_height_)});
// Inicializa variables
fixed_width_ = false;
@@ -137,7 +137,7 @@ void Text::write2X(int x, int y, const std::string& text, int kerning, int lengt
}
// Escribe el texto en una textura
auto Text::writeToTexture(const std::string& text, int zoom, int kerning, int length) -> std::shared_ptr<Texture> {
auto Text::writeToTexture(const std::string& text, int zoom, int kerning, int /*length*/) -> std::shared_ptr<Texture> {
auto* renderer = Screen::get()->getRenderer();
auto texture = std::make_shared<Texture>(renderer);
auto width = Text::length(text, kerning) * zoom;
@@ -342,7 +342,7 @@ void Text::writeDX(Uint8 flags, int x, int y, const std::string& text, int kerni
}
// Escribe texto a partir de un TextStyle
void Text::writeStyle(int x, int y, const std::string& text, const Style& style, int length) {
void Text::writeStyle(int x, int y, const std::string& text, const Style& style, int /*length*/) {
writeDX(style.flags, x, y, text, style.kerning, style.text_color, style.shadow_distance, style.shadow_color);
}
+1 -1
View File
@@ -50,7 +50,7 @@ TiledBG::~TiledBG() {
// Rellena la textura con el contenido
void TiledBG::fillTexture() {
// Crea los objetos para pintar en la textura de fondo
auto tile = std::make_unique<Sprite>(Resource::get()->getTexture("title_bg_tile.png"), (SDL_FRect){.x = 0, .y = 0, .w = TILE_WIDTH, .h = TILE_HEIGHT});
auto tile = std::make_unique<Sprite>(Resource::get()->getTexture("title_bg_tile.png"), SDL_FRect{.x = 0, .y = 0, .w = TILE_WIDTH, .h = TILE_HEIGHT});
// Prepara para dibujar sobre la textura
auto* temp = SDL_GetRenderTarget(renderer_);