Lint: rename de helpers file-static y constexpr locales
Tanda local de identifier-naming: ningún símbolo cross-file, todo contenido en su propio TU. De paso traduce los catalán/spanish a inglés allá donde aplica. - shape_renderer.cpp: apply_3d_rotation → apply3dRotation, transform_point → transformPoint, perspective_factor → PERSPECTIVE_FACTOR (constexpr). - debris_manager.cpp: transform_point → transformPoint (otro file-static con el mismo nombre, no comparte símbolo con shape_renderer). - logo_scene.cpp: calcular_progress_letra → computeLetterProgress. - vector_text.cpp: char_width/char_height → BASE_CHAR_WIDTH/BASE_CHAR_HEIGHT (el sufijo BASE_ evita el conflicto con la macro CHAR_WIDTH de Windows headers que clang-tidy detectó). - floating_score_manager.cpp::draw: constexpr scale/spacing → SCALE/SPACING. - game_scene.cpp::dibuixar_missatge_stage: escala_base/spacing → BASE_SCALE/SPACING (constexpr locales). - game_scene.cpp::dibuixar_continue: constexpr spacing → SPACING. - game_scene.cpp en stepGameOver: constexpr scale/spacing → SCALE/SPACING. - ship_animator.cpp::actualizar_exiting: constexpr Vec2 punt_fuga → VANISHING_POINT. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -528,15 +528,15 @@ void GameScene::draw() {
|
||||
|
||||
// Draw centered "GAME OVER" text
|
||||
const std::string game_over_text = "GAME OVER";
|
||||
constexpr float scale = Defaults::Game::GameOverScreen::TEXT_SCALE;
|
||||
constexpr float spacing = Defaults::Game::GameOverScreen::TEXT_SPACING;
|
||||
constexpr float SCALE = Defaults::Game::GameOverScreen::TEXT_SCALE;
|
||||
constexpr float SPACING = Defaults::Game::GameOverScreen::TEXT_SPACING;
|
||||
|
||||
// Calcular centro de l'àrea de juego usant constants
|
||||
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
||||
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;
|
||||
@@ -790,8 +790,8 @@ auto GameScene::buildScoreboard() const -> std::string {
|
||||
// [NEW] Stage system helper methods
|
||||
|
||||
void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
||||
constexpr float escala_base = 1.0F;
|
||||
constexpr float spacing = 2.0F;
|
||||
constexpr float BASE_SCALE = 1.0F;
|
||||
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;
|
||||
@@ -834,15 +834,15 @@ void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
||||
// ===================================================
|
||||
|
||||
// Calculate text width at base scale (using FULL message for position calculation)
|
||||
float text_width_at_base = text_.get_text_width(message, escala_base, spacing);
|
||||
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)
|
||||
? escala_base
|
||||
? BASE_SCALE
|
||||
: 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);
|
||||
float full_text_width = text_.get_text_width(message, scale, SPACING);
|
||||
float text_height = text_.get_text_height(scale);
|
||||
|
||||
// Calculate position as if FULL text was there (for fixed position typewriter)
|
||||
@@ -851,7 +851,7 @@ void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
||||
|
||||
// Render only the partial message (typewriter effect)
|
||||
Vec2 pos = {.x = x, .y = y};
|
||||
text_.render(partial_message, pos, scale, spacing);
|
||||
text_.render(partial_message, pos, scale, SPACING);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
@@ -910,7 +910,7 @@ void GameScene::disparar_bala(uint8_t player_id) {
|
||||
|
||||
void GameScene::dibuixar_continue() {
|
||||
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
||||
constexpr float spacing = 4.0F;
|
||||
constexpr float SPACING = 4.0F;
|
||||
|
||||
// "CONTINUE" text (using constants)
|
||||
const std::string continue_text = "CONTINUE";
|
||||
@@ -920,7 +920,7 @@ void GameScene::dibuixar_continue() {
|
||||
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_);
|
||||
@@ -929,7 +929,7 @@ void GameScene::dibuixar_continue() {
|
||||
|
||||
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) {
|
||||
@@ -939,7 +939,7 @@ void GameScene::dibuixar_continue() {
|
||||
|
||||
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