clang-tidy

This commit is contained in:
2026-04-03 09:31:41 +02:00
parent 8dcc1d282a
commit 46dc81124f
25 changed files with 320 additions and 314 deletions

View File

@@ -38,12 +38,12 @@ void TilePicker::open(const std::string& tileset_name, int current_tile, int bg_
// Dimensiones de salida (con spacing visual entre tiles)
int out_cell = Tile::SIZE + spacing_out_;
int display_w = tileset_width_ * out_cell - spacing_out_; // Sin trailing
int display_h = tileset_height_ * out_cell - spacing_out_;
int display_w = (tileset_width_ * out_cell) - spacing_out_; // Sin trailing
int display_h = (tileset_height_ * out_cell) - spacing_out_;
// Frame: display + borde
int frame_w = display_w + BORDER_PAD * 2;
int frame_h = display_h + BORDER_PAD * 2;
int frame_w = display_w + (BORDER_PAD * 2);
int frame_h = display_h + (BORDER_PAD * 2);
frame_surface_ = std::make_shared<Surface>(frame_w, frame_h);
// Componer: fondo + borde + tiles uno a uno
@@ -61,7 +61,7 @@ void TilePicker::open(const std::string& tileset_name, int current_tile, int bg_
frame_surface_->drawRectBorder(&inner, stringToColor("white"));
// Renderizar cada tile individualmente
constexpr float TS = static_cast<float>(Tile::SIZE);
constexpr auto TS = static_cast<float>(Tile::SIZE);
for (int row = 0; row < tileset_height_; ++row) {
for (int col = 0; col < tileset_width_; ++col) {
// Fuente: posición en el tileset original
@@ -72,8 +72,8 @@ void TilePicker::open(const std::string& tileset_name, int current_tile, int bg_
.h = TS};
// Destino: posición en el frame con spacing de salida
int dst_x = BORDER_PAD + col * out_cell;
int dst_y = BORDER_PAD + row * out_cell;
int dst_x = BORDER_PAD + (col * out_cell);
int dst_y = BORDER_PAD + (row * out_cell);
if (source_color >= 0 && target_color >= 0) {
tileset_->renderWithColorReplace(dst_x, dst_y, static_cast<Uint8>(source_color), static_cast<Uint8>(target_color), &src);
@@ -90,7 +90,7 @@ void TilePicker::open(const std::string& tileset_name, int current_tile, int bg_
// Centrar en el play area
offset_x_ = (PlayArea::WIDTH - frame_w) / 2;
int offset_y = (PlayArea::HEIGHT - frame_h) / 2;
if (offset_y < 0) { offset_y = 0; }
offset_y = std::max(offset_y, 0);
visible_height_ = PlayArea::HEIGHT;
@@ -143,7 +143,7 @@ void TilePicker::render() {
int out_cell = Tile::SIZE + spacing_out_;
float tileset_screen_x = frame_dst_.x + BORDER_PAD;
float tileset_screen_y = frame_dst_.y + BORDER_PAD - static_cast<float>(scroll_y_);
constexpr float TS = static_cast<float>(Tile::SIZE);
constexpr auto TS = static_cast<float>(Tile::SIZE);
// Highlight del tile bajo el cursor (blanco)
if (hover_tile_ >= 0) {
@@ -190,7 +190,7 @@ void TilePicker::handleEvent(const SDL_Event& event) {
if (event.type == SDL_EVENT_MOUSE_WHEEL) {
scroll_y_ -= static_cast<int>(event.wheel.y) * Tile::SIZE * 2;
int max_scroll = static_cast<int>(frame_dst_.h) - visible_height_;
if (max_scroll < 0) { max_scroll = 0; }
max_scroll = std::max(max_scroll, 0);
scroll_y_ = std::clamp(scroll_y_, 0, max_scroll);
updateMousePosition();
}