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:
@@ -527,7 +527,7 @@ void GameScene::draw() {
|
||||
floating_score_manager_.draw();
|
||||
|
||||
// Draw centered "GAME OVER" text
|
||||
const std::string game_over_text = "GAME OVER";
|
||||
const std::string GAME_OVER_TEXT = "GAME OVER";
|
||||
constexpr float SCALE = Defaults::Game::GameOverScreen::TEXT_SCALE;
|
||||
constexpr float SPACING = Defaults::Game::GameOverScreen::TEXT_SPACING;
|
||||
|
||||
@@ -536,7 +536,7 @@ void GameScene::draw() {
|
||||
float centre_x = play_area.x + (play_area.w / 2.0F);
|
||||
float centre_y = play_area.y + (play_area.h / 2.0F);
|
||||
|
||||
text_.renderCentered(game_over_text, {.x = centre_x, .y = centre_y}, SCALE, SPACING);
|
||||
text_.renderCentered(GAME_OVER_TEXT, {.x = centre_x, .y = centre_y}, SCALE, SPACING);
|
||||
|
||||
dibuixar_marcador();
|
||||
return;
|
||||
@@ -736,16 +736,16 @@ void GameScene::dibuixar_marcador() {
|
||||
std::string text = buildScoreboard();
|
||||
|
||||
// Parámetros de renderització
|
||||
const float scale = 0.85F;
|
||||
const float spacing = 0.0F;
|
||||
const float SCALE = 0.85F;
|
||||
const float SPACING = 0.0F;
|
||||
|
||||
// Calcular centro de la zona del marcador
|
||||
const SDL_FRect& scoreboard = Defaults::Zones::SCOREBOARD;
|
||||
float centre_x = scoreboard.w / 2.0F;
|
||||
float centre_y = scoreboard.y + (scoreboard.h / 2.0F);
|
||||
const SDL_FRect& scoreboard_zone = Defaults::Zones::SCOREBOARD;
|
||||
float centre_x = scoreboard_zone.w / 2.0F;
|
||||
float centre_y = scoreboard_zone.y + (scoreboard_zone.h / 2.0F);
|
||||
|
||||
// Renderizar centrat
|
||||
text_.renderCentered(text, {.x = centre_x, .y = centre_y}, scale, spacing);
|
||||
text_.renderCentered(text, {.x = centre_x, .y = centre_y}, SCALE, SPACING);
|
||||
}
|
||||
|
||||
auto GameScene::buildScoreboard() const -> std::string {
|
||||
@@ -794,7 +794,7 @@ void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
||||
constexpr float SPACING = 2.0F;
|
||||
|
||||
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
||||
const float max_width = play_area.w * Defaults::Game::STAGE_MESSAGE_MAX_WIDTH_RATIO;
|
||||
const float MAX_WIDTH = play_area.w * Defaults::Game::STAGE_MESSAGE_MAX_WIDTH_RATIO;
|
||||
|
||||
// ========== TYPEWRITER EFFECT (PARAMETRIZED) ==========
|
||||
// Get state-specific timing configuration
|
||||
@@ -837,9 +837,9 @@ void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
||||
float text_width_at_base = text_.get_text_width(message, BASE_SCALE, SPACING);
|
||||
|
||||
// Auto-scale if text exceeds max width
|
||||
float scale = (text_width_at_base <= max_width)
|
||||
float scale = (text_width_at_base <= MAX_WIDTH)
|
||||
? BASE_SCALE
|
||||
: max_width / text_width_at_base;
|
||||
: MAX_WIDTH / text_width_at_base;
|
||||
|
||||
// Recalculate dimensions with final scale (using FULL message for centering)
|
||||
float full_text_width = text_.get_text_width(message, scale, SPACING);
|
||||
@@ -913,33 +913,33 @@ void GameScene::dibuixar_continue() {
|
||||
constexpr float SPACING = 4.0F;
|
||||
|
||||
// "CONTINUE" text (using constants)
|
||||
const std::string continue_text = "CONTINUE";
|
||||
const std::string CONTINUE_TEXT = "CONTINUE";
|
||||
float escala_continue = Defaults::Game::ContinueScreen::CONTINUE_TEXT_SCALE;
|
||||
float y_ratio_continue = Defaults::Game::ContinueScreen::CONTINUE_TEXT_Y_RATIO;
|
||||
|
||||
float centre_x = play_area.x + (play_area.w / 2.0F);
|
||||
float centre_y_continue = play_area.y + (play_area.h * y_ratio_continue);
|
||||
|
||||
text_.renderCentered(continue_text, {.x = centre_x, .y = centre_y_continue}, escala_continue, SPACING);
|
||||
text_.renderCentered(CONTINUE_TEXT, {.x = centre_x, .y = centre_y_continue}, escala_continue, SPACING);
|
||||
|
||||
// Countdown number (using constants)
|
||||
const std::string counter_str = std::to_string(continue_counter_);
|
||||
const std::string COUNTER_STR = std::to_string(continue_counter_);
|
||||
float escala_counter = Defaults::Game::ContinueScreen::COUNTER_TEXT_SCALE;
|
||||
float y_ratio_counter = Defaults::Game::ContinueScreen::COUNTER_TEXT_Y_RATIO;
|
||||
|
||||
float centre_y_counter = play_area.y + (play_area.h * y_ratio_counter);
|
||||
|
||||
text_.renderCentered(counter_str, {.x = centre_x, .y = centre_y_counter}, escala_counter, SPACING);
|
||||
text_.renderCentered(COUNTER_STR, {.x = centre_x, .y = centre_y_counter}, escala_counter, SPACING);
|
||||
|
||||
// "CONTINUES LEFT" (conditional + using constants)
|
||||
if (!Defaults::Game::INFINITE_CONTINUES) {
|
||||
const std::string continues_text = "CONTINUES LEFT: " + std::to_string(Defaults::Game::MAX_CONTINUES - continues_used_);
|
||||
const std::string CONTINUES_TEXT = "CONTINUES LEFT: " + std::to_string(Defaults::Game::MAX_CONTINUES - continues_used_);
|
||||
float escala_info = Defaults::Game::ContinueScreen::INFO_TEXT_SCALE;
|
||||
float y_ratio_info = Defaults::Game::ContinueScreen::INFO_TEXT_Y_RATIO;
|
||||
|
||||
float centre_y_info = play_area.y + (play_area.h * y_ratio_info);
|
||||
|
||||
text_.renderCentered(continues_text, {.x = centre_x, .y = centre_y_info}, escala_info, SPACING);
|
||||
text_.renderCentered(CONTINUES_TEXT, {.x = centre_x, .y = centre_y_info}, escala_info, SPACING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user