Canviat el final de linea als scripts de linux

This commit is contained in:
2024-10-24 18:14:33 +02:00
parent 018bb68f9a
commit f26ecbd969
7 changed files with 80 additions and 216 deletions

View File

@@ -21,32 +21,30 @@ struct Animation
Animation() : name(std::string()), speed(5), loop(0), completed(false), current_frame(0), counter(0) {}
};
using Animations = std::vector<std::string>;
using AnimationsFileBuffer = std::vector<std::string>;
// Carga las animaciones en un vector(Animations) desde un fichero
Animations loadAnimationsFromFile(const std::string &file_path);
AnimationsFileBuffer loadAnimationsFromFile(const std::string &file_path);
class AnimatedSprite : public MovingSprite
{
protected:
// Variables
std::vector<Animation> animations_; // Vector con las diferentes animaciones
int current_animation_; // Animacion activa
int current_animation_ = 0; // Animacion activa
// Calcula el frame correspondiente a la animación actual
void animate();
// Carga la animación desde un fichero
std::vector<Animation> loadFromFile(const std::string &file_path);
// Carga la animación desde un vector
bool loadFromVector(const Animations &source);
// Carga la animación desde un vector de cadenas
bool loadFromAnimationsFileBuffer(const AnimationsFileBuffer &source);
public:
// Constructor
AnimatedSprite(std::shared_ptr<Texture> texture, const std::string &file_path);
AnimatedSprite(std::shared_ptr<Texture> texture, const Animations &animations);
explicit AnimatedSprite(std::shared_ptr<Texture> texture);
AnimatedSprite(std::shared_ptr<Texture> texture, const AnimationsFileBuffer &animations);
explicit AnimatedSprite(std::shared_ptr<Texture> texture)
: MovingSprite(texture) {}
// Destructor
virtual ~AnimatedSprite() = default;