forked from jaildesigner-jailgames/jaildoctors_dilemma
Solventat bug amb el punter a ScoreboardData
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "moving_sprite.h" // Para MovingSprite
|
||||
class Texture; // lines 9-9
|
||||
|
||||
struct Animation
|
||||
struct AnimationData
|
||||
{
|
||||
std::string name; // Nombre de la animacion
|
||||
std::vector<SDL_Rect> frames; // Cada uno de los frames que componen la animación
|
||||
@@ -17,31 +17,31 @@ struct Animation
|
||||
int current_frame; // Frame actual
|
||||
int counter; // Contador para las animaciones
|
||||
|
||||
Animation() : name(std::string()), speed(5), loop(0), completed(false), current_frame(0), counter(0) {}
|
||||
AnimationData() : name(std::string()), speed(5), loop(0), completed(false), current_frame(0), counter(0) {}
|
||||
};
|
||||
|
||||
using AnimationsFileBuffer = std::vector<std::string>;
|
||||
using Animations = std::vector<std::string>;
|
||||
|
||||
// Carga las animaciones en un vector(Animations) desde un fichero
|
||||
AnimationsFileBuffer loadAnimationsFromFile(const std::string &file_path);
|
||||
Animations loadAnimationsFromFile(const std::string &file_path);
|
||||
|
||||
class AnimatedSprite : public MovingSprite
|
||||
{
|
||||
protected:
|
||||
// Variables
|
||||
std::vector<Animation> animations_; // Vector con las diferentes animaciones
|
||||
int current_animation_ = 0; // Animacion activa
|
||||
std::vector<AnimationData> animations_; // Vector con las diferentes animaciones
|
||||
int current_animation_ = 0; // Animacion activa
|
||||
|
||||
// Calcula el frame correspondiente a la animación actual
|
||||
void animate();
|
||||
|
||||
// Carga la animación desde un vector de cadenas
|
||||
void loadFromAnimationsFileBuffer(const AnimationsFileBuffer &source);
|
||||
void setAnimations(const Animations &animations);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
AnimatedSprite(std::shared_ptr<Texture> texture, const std::string &file_path);
|
||||
AnimatedSprite(std::shared_ptr<Texture> texture, const AnimationsFileBuffer &animations);
|
||||
AnimatedSprite(std::shared_ptr<Texture> texture, const Animations &animations);
|
||||
explicit AnimatedSprite(std::shared_ptr<Texture> texture)
|
||||
: MovingSprite(texture) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user