2016-03-12 23:22:28 +00:00
|
|
|
#ifndef DEF_XSPRITEANIMATION_H
|
|
|
|
|
|
|
|
#define DEF_XSPRITEANIMATION_H
|
|
|
|
|
2016-03-14 18:28:18 +00:00
|
|
|
class xSpriteAnimation : public xSprite{
|
2016-03-12 23:22:28 +00:00
|
|
|
|
|
|
|
public:
|
2016-03-14 18:28:18 +00:00
|
|
|
xSpriteAnimation(xManager *manager, const char *url, SDL_Rect dest); // Spritesheet avec taille de chaque sprite
|
|
|
|
xSpriteAnimation(xManager *manager, SDL_Texture *t, SDL_Rect dest); // Spritesheet avec taille de chaque sprite
|
2016-03-12 23:22:28 +00:00
|
|
|
~xSpriteAnimation();
|
|
|
|
|
2016-03-13 09:08:07 +00:00
|
|
|
void addFrame(SDL_Rect clip); // Ajoute une frame en fonction des coordonnees
|
2016-03-14 15:10:21 +00:00
|
|
|
void clear(); // Supprime les frames
|
2016-03-12 23:22:28 +00:00
|
|
|
|
2016-03-14 18:28:18 +00:00
|
|
|
void push(string index); // Ajoute au rendu
|
2016-03-13 19:36:16 +00:00
|
|
|
|
2016-03-13 09:08:07 +00:00
|
|
|
// Gestion de l'animation
|
2016-03-14 15:10:21 +00:00
|
|
|
void start(int t, int flags=SPRITE_ANIM_ONCE);
|
2016-03-13 19:36:16 +00:00
|
|
|
void stop();
|
2016-03-13 17:33:47 +00:00
|
|
|
|
2016-03-12 23:22:28 +00:00
|
|
|
|
|
|
|
|
2016-03-13 09:08:07 +00:00
|
|
|
|
2016-03-13 13:53:39 +00:00
|
|
|
protected:
|
2016-03-12 23:22:28 +00:00
|
|
|
// Contiendra les frames
|
|
|
|
vector<SDL_Rect> _frames;
|
|
|
|
|
2016-03-14 18:28:18 +00:00
|
|
|
// Pour rappel animation
|
2016-03-13 23:06:33 +00:00
|
|
|
int _timeout;
|
|
|
|
int _flags;
|
|
|
|
|
2016-03-12 23:22:28 +00:00
|
|
|
// Contiendra le thread de l'animation
|
|
|
|
thread *_animation;
|
|
|
|
friend void xSpriteAnimationProcess(xSpriteAnimation *xSA, int t, int flags );
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|