Commit de vesprà tirada a la brossa
This commit is contained in:
@@ -19,14 +19,8 @@ struct Animation
|
||||
int counter; // Contador para las animaciones
|
||||
};
|
||||
|
||||
struct AnimatedFile
|
||||
{
|
||||
std::vector<Animation> animations; // Vector con las diferentes animaciones
|
||||
std::shared_ptr<Texture> texture; // Textura con los graficos para el sprite
|
||||
};
|
||||
|
||||
// Carga la animación desde un fichero
|
||||
AnimatedFile loadAnimationFromFile(std::shared_ptr<Texture> texture, std::string filePath);
|
||||
std::vector<Animation> loadAnimationFromFile(std::shared_ptr<Texture> texture, std::string filePath);
|
||||
|
||||
class AnimatedSprite : public MovingSprite
|
||||
{
|
||||
@@ -35,16 +29,20 @@ protected:
|
||||
std::vector<Animation> animations_; // Vector con las diferentes animaciones
|
||||
int current_animation_; // Animacion activa
|
||||
|
||||
// Calcula el frame correspondiente a la animación actual
|
||||
void animate();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
explicit AnimatedSprite(std::shared_ptr<Texture> texture = nullptr, const std::string &file = std::string(), std::vector<std::string> *buffer = nullptr);
|
||||
explicit AnimatedSprite(const AnimatedFile *animation);
|
||||
AnimatedSprite(std::shared_ptr<Texture> texture, const std::string &file_path);
|
||||
AnimatedSprite(std::shared_ptr<Texture> texture, std::vector<std::string> *animations);
|
||||
explicit AnimatedSprite(std::shared_ptr<Texture> texture);
|
||||
|
||||
// Destructor
|
||||
virtual ~AnimatedSprite();
|
||||
|
||||
// Calcula el frame correspondiente a la animación actual
|
||||
void animate();
|
||||
// Actualiza las variables del objeto
|
||||
void update() override;
|
||||
|
||||
// Obtiene el número de frames de la animación actual
|
||||
int getNumFrames();
|
||||
@@ -84,9 +82,6 @@ public:
|
||||
void setCurrentAnimation(const std::string &name = "default");
|
||||
void setCurrentAnimation(int index = 0);
|
||||
|
||||
// Actualiza las variables del objeto
|
||||
void update() override;
|
||||
|
||||
// OLD - Establece el rectangulo para un frame de una animación
|
||||
void setAnimationFrames(Uint8 index_animation, Uint8 index_frame, int x, int y, int w, int h);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user