Lint: rename de locales (constants + const-ref vars)

Tanda de identifier-naming de variables y constantes locales a funciones
o archivos. Ninguno cross-file (los símbolos públicos quedan para una
pasada manual con VS Code).

- audio_adapter.cpp: path → PATH (const local en 3 funciones).
- vector_text.cpp: symbols → SYMBOLS, char_width_scaled → CHAR_WIDTH_SCALED,
  char_height_scaled → CHAR_HEIGHT_SCALED, spacing_scaled → SPACING_SCALED
  (const locales en render/renderCentered/get_text_width).
- physics_world.cpp: acceleration → ACCELERATION (const local en update).
- constants.hpp::dins_zona_joc: point → POINT.
- game_scene.cpp:
  - stepGameOver: game_over_text → GAME_OVER_TEXT.
  - dibuixar_marcador: scale/spacing → SCALE/SPACING (const), y la ref
    local 'scoreboard' (const SDL_FRect&) → 'scoreboard_zone' para no
    colisionar con Defaults::Zones::SCOREBOARD (las refs no son
    "constant" según el .clang-tidy y deben ser lower_case).
  - dibuixar_missatge_stage: max_width → MAX_WIDTH (const local).
  - dibuixar_continue: continue_text/counter_str/continues_text →
    UPPER_CASE.
- title_scene.cpp::draw (sección MAIN): spacing → SPACING, main_text →
  MAIN_TEXT, escala_main → MAIN_SCALE.
- shape_renderer.cpp: const Vec2& SHAPE_CENTRE → shape_centre (es ref,
  no constant).
- collision_system.cpp: const Vec2& POS_ENEMIC → enemy_pos (ref + traducción).
- init_hud_animator.cpp: refs ZONA → zone (en 2 funciones), SCOREBOARD →
  scoreboard_zone (sin colisionar con Defaults::Zones::SCOREBOARD).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 11:50:58 +02:00
parent 1214599c4c
commit c80212adb9
9 changed files with 66 additions and 66 deletions
+12 -12
View File
@@ -47,8 +47,8 @@ void VectorText::load_charset() {
}
// Cargar símbolos
const std::string symbols[] = {".", ",", "-", ":", "!", "?"};
for (const auto& sym : symbols) {
const std::string SYMBOLS[] = {".", ",", "-", ":", "!", "?"};
for (const auto& sym : SYMBOLS) {
char c = sym[0];
std::string filename = get_shape_filename(c);
auto shape = ShapeLoader::load(filename);
@@ -185,13 +185,13 @@ void VectorText::render(const std::string& text, const Vec2& position, float sca
}
// Ancho de un carácter base (20 px a scale 1.0)
const float char_width_scaled = BASE_CHAR_WIDTH * scale;
const float CHAR_WIDTH_SCALED = BASE_CHAR_WIDTH * scale;
// Spacing escalado
const float spacing_scaled = spacing * scale;
const float SPACING_SCALED = spacing * scale;
// Altura de un carácter escalado (necesario para ajustar Y)
const float char_height_scaled = BASE_CHAR_HEIGHT * scale;
const float CHAR_HEIGHT_SCALED = BASE_CHAR_HEIGHT * scale;
// Posición X del borde izquierdo del carácter actual
// (se ajustará +BASE_CHAR_WIDTH/2 para obtener el centro al renderizar)
@@ -210,7 +210,7 @@ void VectorText::render(const std::string& text, const Vec2& position, float sca
// Manejar espacios (avanzar sin dibujar)
if (c == ' ') {
current_x += char_width_scaled + spacing_scaled;
current_x += CHAR_WIDTH_SCALED + SPACING_SCALED;
continue;
}
@@ -220,16 +220,16 @@ void VectorText::render(const std::string& text, const Vec2& position, float sca
// Renderizar carácter
// Ajustar X e Y para que position represente esquina superior izquierda
// (render_shape espera el centro, así que sumamos la mitad de ancho y altura)
Vec2 char_pos = {.x = current_x + (char_width_scaled / 2.0F), .y = position.y + (char_height_scaled / 2.0F)};
Vec2 char_pos = {.x = current_x + (CHAR_WIDTH_SCALED / 2.0F), .y = position.y + (CHAR_HEIGHT_SCALED / 2.0F)};
Rendering::render_shape(renderer_, it->second, char_pos, 0.0F, scale, 1.0F, brightness);
// Avanzar posición
current_x += char_width_scaled + spacing_scaled;
current_x += CHAR_WIDTH_SCALED + SPACING_SCALED;
} else {
// Carácter no soportado: saltar (o renderizar '?' en el futuro)
std::cerr << "[VectorText] Warning: caràcter no suportat '" << c << "'"
<< '\n';
current_x += char_width_scaled + spacing_scaled;
current_x += CHAR_WIDTH_SCALED + SPACING_SCALED;
}
}
}
@@ -254,8 +254,8 @@ auto VectorText::get_text_width(const std::string& text, float scale, float spac
return 0.0F;
}
const float char_width_scaled = BASE_CHAR_WIDTH * scale;
const float spacing_scaled = spacing * scale;
const float CHAR_WIDTH_SCALED = BASE_CHAR_WIDTH * scale;
const float SPACING_SCALED = spacing * scale;
// Contar caracteres visuals (no bytes) - manejar UTF-8
size_t visual_chars = 0;
@@ -273,7 +273,7 @@ auto VectorText::get_text_width(const std::string& text, float scale, float spac
}
// Ancho total = todos los caracteres VISUALES + spacing entre ellos
return (visual_chars * char_width_scaled) + ((visual_chars - 1) * spacing_scaled);
return (visual_chars * CHAR_WIDTH_SCALED) + ((visual_chars - 1) * SPACING_SCALED);
}
auto VectorText::get_text_height(float scale) const -> float {