Fase 1b: rename d'entitats i metodes virtuals a CamelCase/camelBack
Tots els tipus d'entitat passen del catala a l'angles seguint el
.clang-tidy del projecte (tipus en CamelCase, metodes en camelBack,
membres en lower_case amb sufix _).
Renames de tipus:
- Entitat -> Entity (core/entities/entity.hpp)
- Nau -> Ship (game/entities/ship.{hpp,cpp})
- Enemic -> Enemy (game/entities/enemy.{hpp,cpp})
- Bala -> Bullet (game/entities/bullet.{hpp,cpp})
- TipusEnemic -> EnemyType
- AnimacioEnemic -> EnemyAnimation
Metodes virtuals (s'aplica a tot el codi, no nomes a entitats):
- actualitzar -> update
- dibuixar -> draw
- inicialitzar -> init
- processar_input -> processInput
- esta_actiu -> isActive
- es_collidable -> isCollidable
- get_collision_radius -> getCollisionRadius
Getters comuns:
- get_centre -> getCenter
- get_angle -> getAngle
- get_brightness -> getBrightness
- get_forma -> getShape
Metodes especifics:
- esta_viva -> isAlive
- esta_tocada -> isHit
- es_invulnerable -> isInvulnerable
- get_velocitat_vector -> getVelocityVector
- set_centre -> setCenter
- marcar_tocada -> markHit
- aplicar_fisica -> applyPhysics
- get_tipus -> getType
Camps privats:
- centre_ -> center_
- velocitat_ -> velocity_
- forma_ -> shape_
- esta_tocada_ -> is_hit_
- tipus_ -> type_
L'import d'audio/input d'AEEA quedara coherent (mateix estil).
Diff net: 30 fitxers, +437/-437 (la majoria es renames simetrics).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -79,7 +79,7 @@ EscenaTitol::EscenaTitol(SDLManager& sdl, ContextEscenes& context)
|
||||
|
||||
// Inicialitzar animador de naus 3D
|
||||
ship_animator_ = std::make_unique<Title::ShipAnimator>(sdl_.obte_renderer());
|
||||
ship_animator_->inicialitzar();
|
||||
ship_animator_->init();
|
||||
|
||||
if (estat_actual_ == EstatTitol::MAIN) {
|
||||
// Jump to MAIN: empezar entrada inmediatamente
|
||||
@@ -145,7 +145,7 @@ void EscenaTitol::inicialitzar_titol() {
|
||||
// Escalar ancho, altura i offset amb LOGO_SCALE
|
||||
float ancho = ancho_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float altura = altura_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float offset_centre = (forma->get_centre().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float offset_centre = (forma->getCenter().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
|
||||
lletres_orni_.push_back({forma, {.x = 0.0F, .y = 0.0F}, ancho, altura, offset_centre});
|
||||
|
||||
@@ -219,7 +219,7 @@ void EscenaTitol::inicialitzar_titol() {
|
||||
// Escalar ancho, altura i offset amb LOGO_SCALE
|
||||
float ancho = ancho_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float altura = altura_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float offset_centre = (forma->get_centre().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float offset_centre = (forma->getCenter().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
|
||||
lletres_attack_.push_back({forma, {.x = 0.0F, .y = 0.0F}, ancho, altura, offset_centre});
|
||||
|
||||
@@ -295,7 +295,7 @@ void EscenaTitol::executar() {
|
||||
}
|
||||
|
||||
// Actualitzar lògica
|
||||
actualitzar(delta_time);
|
||||
update(delta_time);
|
||||
|
||||
// Actualitzar sistema d'audio
|
||||
Audio::update();
|
||||
@@ -310,7 +310,7 @@ void EscenaTitol::executar() {
|
||||
sdl_.updateRenderingContext();
|
||||
|
||||
// Dibuixar
|
||||
dibuixar();
|
||||
draw();
|
||||
|
||||
// Presentar renderer (swap buffers)
|
||||
sdl_.presenta();
|
||||
@@ -319,10 +319,10 @@ void EscenaTitol::executar() {
|
||||
std::cout << "Escena Titol: Finalitzant...\n";
|
||||
}
|
||||
|
||||
void EscenaTitol::actualitzar(float delta_time) {
|
||||
void EscenaTitol::update(float delta_time) {
|
||||
// Actualitzar starfield (sempre actiu)
|
||||
if (starfield_) {
|
||||
starfield_->actualitzar(delta_time);
|
||||
starfield_->update(delta_time);
|
||||
}
|
||||
|
||||
// Actualitzar naus (quan visibles)
|
||||
@@ -331,7 +331,7 @@ void EscenaTitol::actualitzar(float delta_time) {
|
||||
estat_actual_ == EstatTitol::STARFIELD ||
|
||||
estat_actual_ == EstatTitol::MAIN ||
|
||||
estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE)) {
|
||||
ship_animator_->actualitzar(delta_time);
|
||||
ship_animator_->update(delta_time);
|
||||
}
|
||||
|
||||
switch (estat_actual_) {
|
||||
@@ -541,10 +541,10 @@ void EscenaTitol::actualitzar_animacio_logo(float delta_time) {
|
||||
}
|
||||
}
|
||||
|
||||
void EscenaTitol::dibuixar() {
|
||||
void EscenaTitol::draw() {
|
||||
// Dibuixar starfield de fons (en tots els estats excepte BLACK_SCREEN)
|
||||
if (starfield_ && estat_actual_ != EstatTitol::BLACK_SCREEN) {
|
||||
starfield_->dibuixar();
|
||||
starfield_->draw();
|
||||
}
|
||||
|
||||
// Dibuixar naus (després starfield, abans logo)
|
||||
@@ -553,7 +553,7 @@ void EscenaTitol::dibuixar() {
|
||||
estat_actual_ == EstatTitol::STARFIELD ||
|
||||
estat_actual_ == EstatTitol::MAIN ||
|
||||
estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE)) {
|
||||
ship_animator_->dibuixar();
|
||||
ship_animator_->draw();
|
||||
}
|
||||
|
||||
// En els estats STARFIELD_FADE_IN i STARFIELD, només mostrar starfield (sense text)
|
||||
@@ -562,7 +562,7 @@ void EscenaTitol::dibuixar() {
|
||||
}
|
||||
|
||||
// Estat MAIN i PLAYER_JOIN_PHASE: Dibuixar títol i text (sobre el starfield)
|
||||
// BLACK_SCREEN: no dibuixar res (fons negre ja està netejat)
|
||||
// BLACK_SCREEN: no draw res (fons negre ja està netejat)
|
||||
if (estat_actual_ == EstatTitol::MAIN || estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE) {
|
||||
// === Calcular i renderitzar ombra (només si animació activa) ===
|
||||
if (animacio_activa_) {
|
||||
@@ -726,5 +726,5 @@ auto EscenaTitol::checkStartGameButtonPressed() -> bool {
|
||||
}
|
||||
|
||||
void EscenaTitol::processar_events(const SDL_Event& event) {
|
||||
// No procesar eventos genéricos aquí - la lógica se movió a actualitzar()
|
||||
// No procesar eventos genéricos aquí - la lógica se movió a update()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user