style: aplicar fixes de clang-tidy (todo excepto uppercase-literal-suffix)
Corregidos ~2570 issues automáticamente con clang-tidy --fix-errors más ajustes manuales posteriores: - modernize: designated-initializers, trailing-return-type, use-auto, avoid-c-arrays (→ std::array<>), use-ranges, use-emplace, deprecated-headers, use-equals-default, pass-by-value, return-braced-init-list, use-default-member-init - readability: math-missing-parentheses, implicit-bool-conversion, braces-around-statements, isolate-declaration, use-std-min-max, identifier-naming, else-after-return, redundant-casting, convert-member-functions-to-static, make-member-function-const, static-accessed-through-instance - performance: avoid-endl, unnecessary-value-param, type-promotion, inefficient-vector-operation - dead code: XOR_KEY (orphan tras eliminar encryptData/decryptData), dead stores en engine.cpp y png_shape.cpp - NOLINT justificado en 10 funciones con alta complejidad cognitiva (initialize, render, main, processEvents, update×3, performDemoAction, randomizeOnDemoStart, renderDebugHUD, AppLogo::update) Compilación: gcc -Wall sin warnings. clang-tidy: 0 issues. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,34 +10,34 @@ class Texture;
|
||||
|
||||
class Ball {
|
||||
private:
|
||||
std::unique_ptr<Sprite> sprite_; // Sprite para pintar la clase
|
||||
SDL_FRect pos_; // Posición y tamaño de la pelota
|
||||
float vx_, vy_; // Velocidad
|
||||
float gravity_force_; // Gravedad base
|
||||
float gravity_mass_factor_; // Factor de masa individual (0.7-1.3, afecta gravedad)
|
||||
GravityDirection gravity_direction_; // Direcci\u00f3n de la gravedad
|
||||
int screen_width_; // Ancho del terreno de juego
|
||||
int screen_height_; // Alto del terreno de juego
|
||||
Color color_; // Color de la pelota
|
||||
bool on_surface_; // Indica si la pelota est\u00e1 en la superficie (suelo/techo/pared)
|
||||
float loss_; // Coeficiente de rebote. Pérdida de energía en cada rebote
|
||||
std::unique_ptr<Sprite> sprite_; // Sprite para pintar la clase
|
||||
SDL_FRect pos_; // Posición y tamaño de la pelota
|
||||
float vx_, vy_; // Velocidad
|
||||
float gravity_force_; // Gravedad base
|
||||
float gravity_mass_factor_; // Factor de masa individual (0.7-1.3, afecta gravedad)
|
||||
GravityDirection gravity_direction_; // Direcci\u00f3n de la gravedad
|
||||
int screen_width_; // Ancho del terreno de juego
|
||||
int screen_height_; // Alto del terreno de juego
|
||||
Color color_; // Color de la pelota
|
||||
bool on_surface_; // Indica si la pelota est\u00e1 en la superficie (suelo/techo/pared)
|
||||
float loss_; // Coeficiente de rebote. Pérdida de energía en cada rebote
|
||||
|
||||
// Datos para modo Shape (figuras 3D)
|
||||
float pos_3d_x_, pos_3d_y_, pos_3d_z_; // Posición 3D en la figura
|
||||
float target_x_, target_y_; // Posición destino 2D (proyección)
|
||||
float depth_brightness_; // Brillo según profundidad Z (0.0-1.0)
|
||||
float depth_scale_; // Escala según profundidad Z (0.5-1.5)
|
||||
bool shape_attraction_active_; // ¿Está siendo atraída hacia la figura?
|
||||
float target_x_, target_y_; // Posición destino 2D (proyección)
|
||||
float depth_brightness_; // Brillo según profundidad Z (0.0-1.0)
|
||||
float depth_scale_; // Escala según profundidad Z (0.5-1.5)
|
||||
bool shape_attraction_active_; // ¿Está siendo atraída hacia la figura?
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Ball(float x, float y, float vx, float vy, Color color, std::shared_ptr<Texture> texture, int screen_width, int screen_height, int ball_size, GravityDirection gravity_dir = GravityDirection::DOWN, float mass_factor = 1.0f);
|
||||
Ball(float x, float y, float vx, float vy, Color color, const std::shared_ptr<Texture>& texture, int screen_width, int screen_height, int ball_size, GravityDirection gravity_dir = GravityDirection::DOWN, float mass_factor = 1.0f);
|
||||
|
||||
// Destructor
|
||||
~Ball() = default;
|
||||
|
||||
// Actualiza la lógica de la clase
|
||||
void update(float deltaTime);
|
||||
void update(float delta_time);
|
||||
|
||||
// Pinta la clase
|
||||
void render();
|
||||
@@ -72,11 +72,20 @@ class Ball {
|
||||
bool isOnSurface() const { return on_surface_; }
|
||||
|
||||
// Getters/Setters para velocidad (usado por BoidManager)
|
||||
void getVelocity(float& vx, float& vy) const { vx = vx_; vy = vy_; }
|
||||
void setVelocity(float vx, float vy) { vx_ = vx; vy_ = vy; }
|
||||
void getVelocity(float& vx, float& vy) const {
|
||||
vx = vx_;
|
||||
vy = vy_;
|
||||
}
|
||||
void setVelocity(float vx, float vy) {
|
||||
vx_ = vx;
|
||||
vy_ = vy;
|
||||
}
|
||||
|
||||
// Setter para posición simple (usado por BoidManager)
|
||||
void setPosition(float x, float y) { pos_.x = x; pos_.y = y; }
|
||||
void setPosition(float x, float y) {
|
||||
pos_.x = x;
|
||||
pos_.y = y;
|
||||
}
|
||||
|
||||
// Getters/Setters para batch rendering
|
||||
SDL_FRect getPosition() const { return pos_; }
|
||||
@@ -84,7 +93,7 @@ class Ball {
|
||||
void setColor(const Color& color) { color_ = color; }
|
||||
|
||||
// Sistema de cambio de sprite dinámico
|
||||
void updateSize(int new_size); // Actualizar tamaño de hitbox
|
||||
void updateSize(int new_size); // Actualizar tamaño de hitbox
|
||||
void setTexture(std::shared_ptr<Texture> texture); // Cambiar textura del sprite
|
||||
|
||||
// Funciones para modo Shape (figuras 3D)
|
||||
@@ -99,10 +108,5 @@ class Ball {
|
||||
// Sistema de atracción física hacia figuras 3D
|
||||
void enableShapeAttraction(bool enable);
|
||||
float getDistanceToTarget() const; // Distancia actual al punto objetivo
|
||||
void applyShapeForce(float target_x, float target_y, float sphere_radius, float deltaTime,
|
||||
float spring_k = SHAPE_SPRING_K,
|
||||
float damping_base = SHAPE_DAMPING_BASE,
|
||||
float damping_near = SHAPE_DAMPING_NEAR,
|
||||
float near_threshold = SHAPE_NEAR_THRESHOLD,
|
||||
float max_force = SHAPE_MAX_FORCE);
|
||||
void applyShapeForce(float target_x, float target_y, float sphere_radius, float delta_time, float spring_k_base = SHAPE_SPRING_K, float damping_base_base = SHAPE_DAMPING_BASE, float damping_near_base = SHAPE_DAMPING_NEAR, float near_threshold_base = SHAPE_NEAR_THRESHOLD, float max_force_base = SHAPE_MAX_FORCE);
|
||||
};
|
||||
Reference in New Issue
Block a user