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:
@@ -0,0 +1,49 @@
|
||||
// entitat.hpp - Classe base abstracta per a totes les entitats del joc
|
||||
// © 2025 Orni Attack - Arquitectura d'entitats
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "core/graphics/shape.hpp"
|
||||
#include "core/types.hpp"
|
||||
|
||||
namespace Entities {
|
||||
|
||||
class Entity {
|
||||
public:
|
||||
virtual ~Entity() = default;
|
||||
|
||||
// Interfície principal (virtual pur)
|
||||
virtual void init() = 0;
|
||||
virtual void update(float delta_time) = 0;
|
||||
virtual void draw() const = 0;
|
||||
[[nodiscard]] virtual bool isActive() const = 0;
|
||||
|
||||
// Interfície de col·lisió (override opcional)
|
||||
[[nodiscard]] virtual float getCollisionRadius() const { return 0.0F; }
|
||||
[[nodiscard]] virtual bool isCollidable() const { return false; }
|
||||
|
||||
// Getters comuns (inline, sense overhead)
|
||||
[[nodiscard]] const Vec2& getCenter() const { return center_; }
|
||||
[[nodiscard]] float getAngle() const { return angle_; }
|
||||
[[nodiscard]] float getBrightness() const { return brightness_; }
|
||||
[[nodiscard]] const std::shared_ptr<Graphics::Shape>& getShape() const { return shape_; }
|
||||
|
||||
protected:
|
||||
// Estat comú (accés directe, sense overhead)
|
||||
SDL_Renderer* renderer_;
|
||||
std::shared_ptr<Graphics::Shape> shape_;
|
||||
Vec2 center_;
|
||||
float angle_{0.0F};
|
||||
float brightness_{1.0F};
|
||||
|
||||
// Constructor protegit (classe abstracta)
|
||||
Entity(SDL_Renderer* renderer = nullptr)
|
||||
: renderer_(renderer),
|
||||
center_({.x = 0.0F, .y = 0.0F}) {}
|
||||
};
|
||||
|
||||
} // namespace Entities
|
||||
Reference in New Issue
Block a user