style: aplicar checks modernize-* (215 fixes)
Cambios aplicados:
- [[nodiscard]] añadido a funciones que retornan valores
- .starts_with() en lugar de .find() == 0
- Inicializadores designados {.x=0, .y=0}
- auto en castings obvios
- = default para constructores triviales
- Funciones deleted movidas a public
- std::numbers::pi_v<float> (C++20)
Checks excluidos:
- use-trailing-return-type: Estilo controversial
- avoid-c-arrays: Arrays C aceptables en ciertos contextos
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <numbers>
|
||||
#include <string>
|
||||
|
||||
#include "core/audio/audio.hpp"
|
||||
@@ -51,8 +52,8 @@ EscenaTitol::EscenaTitol(SDLManager& sdl, ContextEscenes& context)
|
||||
|
||||
// Crear starfield de fons
|
||||
Punt centre_pantalla{
|
||||
Defaults::Game::WIDTH / 2.0F,
|
||||
Defaults::Game::HEIGHT / 2.0F};
|
||||
.x = Defaults::Game::WIDTH / 2.0F,
|
||||
.y = Defaults::Game::HEIGHT / 2.0F};
|
||||
|
||||
SDL_FRect area_completa{
|
||||
0,
|
||||
@@ -146,7 +147,7 @@ void EscenaTitol::inicialitzar_titol() {
|
||||
float altura = altura_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float offset_centre = (forma->get_centre().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
|
||||
lletres_orni_.push_back({forma, {0.0F, 0.0F}, ancho, altura, offset_centre});
|
||||
lletres_orni_.push_back({forma, {.x = 0.0F, .y = 0.0F}, ancho, altura, offset_centre});
|
||||
|
||||
ancho_total_orni += ancho;
|
||||
}
|
||||
@@ -220,7 +221,7 @@ void EscenaTitol::inicialitzar_titol() {
|
||||
float altura = altura_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float offset_centre = (forma->get_centre().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
|
||||
lletres_attack_.push_back({forma, {0.0F, 0.0F}, ancho, altura, offset_centre});
|
||||
lletres_attack_.push_back({forma, {.x = 0.0F, .y = 0.0F}, ancho, altura, offset_centre});
|
||||
|
||||
ancho_total_attack += ancho;
|
||||
}
|
||||
@@ -653,7 +654,7 @@ void EscenaTitol::dibuixar() {
|
||||
bool mostrar_text = true;
|
||||
if (estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE) {
|
||||
// Parpelleig: sin oscil·la entre -1 i 1, volem ON quan > 0
|
||||
float fase = temps_acumulat_ * BLINK_FREQUENCY * 2.0F * 3.14159F; // 2π × freq × temps
|
||||
float fase = temps_acumulat_ * BLINK_FREQUENCY * 2.0F * std::numbers::pi_v<float>; // 2π × freq × temps
|
||||
mostrar_text = (std::sin(fase) > 0.0F);
|
||||
}
|
||||
|
||||
@@ -664,7 +665,7 @@ void EscenaTitol::dibuixar() {
|
||||
float centre_x = Defaults::Game::WIDTH / 2.0F;
|
||||
float centre_y = Defaults::Game::HEIGHT * Defaults::Title::Layout::PRESS_START_POS;
|
||||
|
||||
text_.render_centered(main_text, {centre_x, centre_y}, escala_main, spacing);
|
||||
text_.render_centered(main_text, {.x = centre_x, .y = centre_y}, escala_main, spacing);
|
||||
}
|
||||
|
||||
// === Copyright a la part inferior (centrat horitzontalment, dues línies) ===
|
||||
@@ -695,8 +696,8 @@ void EscenaTitol::dibuixar() {
|
||||
// Renderitzar línees centrades
|
||||
float centre_x = Defaults::Game::WIDTH / 2.0F;
|
||||
|
||||
text_.render_centered(copyright_original, {centre_x, y_line1}, escala_copy, spacing);
|
||||
text_.render_centered(copyright_port, {centre_x, y_line2}, escala_copy, spacing);
|
||||
text_.render_centered(copyright_original, {.x = centre_x, .y = y_line1}, escala_copy, spacing);
|
||||
text_.render_centered(copyright_port, {.x = centre_x, .y = y_line2}, escala_copy, spacing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user