39 lines
862 B
C++
39 lines
862 B
C++
#ifndef DEF_XSPRITEANIMATION_H
|
|
|
|
#define DEF_XSPRITEANIMATION_H
|
|
|
|
class xSpriteAnimation{
|
|
|
|
public:
|
|
xSpriteAnimation(xManager *manager, const char *url, SDL_Rect viewport); // Spritesheet avec taille de chaque sprite
|
|
~xSpriteAnimation();
|
|
|
|
void addFrame(SDL_Rect clip); // Ajoute une frame en fonction des coordonnees
|
|
|
|
// GETTER
|
|
xManager *manager();
|
|
|
|
// Gestion de l'animation
|
|
void start(int t, int flags=SPRITE_ANIM_ONCE);
|
|
void stop();
|
|
|
|
|
|
|
|
private:
|
|
xManager *_manager;
|
|
SDL_Texture *_texture;
|
|
|
|
// Position de l'animation
|
|
SDL_Rect _viewport;
|
|
|
|
// Contiendra les frames
|
|
vector<SDL_Rect> _frames;
|
|
SDL_Rect _frame; // Frame courante
|
|
|
|
// Contiendra le thread de l'animation
|
|
thread *_animation;
|
|
friend void xSpriteAnimationProcess(xSpriteAnimation *xSA, int t, int flags );
|
|
|
|
};
|
|
|
|
#endif |