balloon: readability-function-cognitive-complexity

balloon: eliminat l'efecte de rebot per als globos mes xicotets
moving_sprite: canviats variables i metodes zoomW a horizontal_zoom i zoomH a vertical_zoom
This commit is contained in:
2025-07-23 18:03:49 +02:00
parent b0564ceccf
commit 5f170ee44e
4 changed files with 166 additions and 119 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <SDL3/SDL.h> // Para SDL_FlipMode, SDL_FPoint, SDL_FRect
#include <algorithm> // Para max
#include <memory> // Para shared_ptr
@@ -50,8 +51,8 @@ class MovingSprite : public Sprite {
// --- Rotación ---
[[nodiscard]] auto isRotating() const -> bool { return rotate_.enabled; }
void setZoomW(float value) { zoom_w_ = value; }
void setZoomH(float value) { zoom_h_ = value; }
void setHorizontalZoom(float value) { horizontal_zoom_ = value; }
void setVerticalZoom(float value) { vertical_zoom_ = value; }
void setAngle(double value) { rotate_.angle = value; }
void setRotatingCenter(SDL_FPoint point) { rotate_.center = point; }
void setRotate(bool enable); // Activa o desactiva el efecto de rotación
@@ -82,10 +83,10 @@ class MovingSprite : public Sprite {
float ay_ = 0.0F; // Aceleración en el eje Y. Variación de la velocidad
// --- Efectos visuales ---
Rotate rotate_; // Variables usadas para controlar la rotación del sprite
float zoom_w_; // Zoom aplicado a la anchura
float zoom_h_; // Zoom aplicado a la altura
SDL_FlipMode flip_; // Indica cómo se voltea el sprite
Rotate rotate_; // Variables usadas para controlar la rotación del sprite
float horizontal_zoom_; // Zoom aplicado a la anchura
float vertical_zoom_; // Zoom aplicado a la altura
SDL_FlipMode flip_; // Indica cómo se voltea el sprite
// --- Métodos internos ---
void updateAngle() { rotate_.angle += rotate_.amount; } // Incrementa el valor del ángulo