revisat moving i animated sprite

This commit is contained in:
2025-09-23 08:29:29 +02:00
parent 8f83a1d13e
commit 1a6ef79466
5 changed files with 19 additions and 21 deletions

View File

@@ -17,15 +17,14 @@ class Texture;
// --- Estructuras ---
struct Animation {
static constexpr int DEFAULT_SPEED = 5;
static constexpr float DEFAULT_SPEED = 80.0F;
std::string name; // Nombre de la animación
std::vector<SDL_FRect> frames; // Frames que componen la animación
int speed{DEFAULT_SPEED}; // Velocidad de reproducción (frame-based)
float speed{DEFAULT_SPEED}; // Velocidad de reproducción (ms entre frames)
int loop{0}; // Frame de vuelta al terminar (-1 para no repetir)
bool completed{false}; // Indica si la animación ha finalizado
size_t current_frame{0}; // Frame actual en reproducción
int counter{0}; // Contador para la animación (frame-based)
float time_accumulator{0.0f}; // Acumulador de tiempo para animaciones time-based
bool paused{false}; // La animación no avanza