Comença a estar tot mes o menos be el desaguisao de les classes Sprite. Encara algunes animacions sembla que van massa ràpides

This commit is contained in:
2024-10-17 19:26:39 +02:00
parent 59de566c5b
commit 50a376e582
12 changed files with 246 additions and 208 deletions

View File

@@ -19,9 +19,6 @@ struct Animation
int counter; // Contador para las animaciones
};
// Carga la animación desde un fichero
std::vector<Animation> loadAnimationFromFile(std::shared_ptr<Texture> texture, std::string filePath);
class AnimatedSprite : public MovingSprite
{
protected:
@@ -32,6 +29,12 @@ protected:
// Calcula el frame correspondiente a la animación actual
void animate();
// Carga la animación desde un fichero
std::vector<Animation> loadFromFile(std::string filePath);
// Carga la animación desde un vector
bool loadFromVector(std::vector<std::string> *source);
public:
// Constructor
AnimatedSprite(std::shared_ptr<Texture> texture, const std::string &file_path);
@@ -75,9 +78,6 @@ public:
// Obtiene el indice de la animación a partir del nombre
int getIndex(const std::string &name);
// Carga la animación desde un vector
bool loadFromVector(std::vector<std::string> *source);
// Establece la animacion actual
void setCurrentAnimation(const std::string &name = "default");
void setCurrentAnimation(int index = 0);