#ifndef DEF_XSPRITEANIMATION_H #define DEF_XSPRITEANIMATION_H #include "SDL.h" #include #include "xSprite.h" #include "xApplication.h" #include "xElement.h" #include "xOrchestrable.h" using namespace std; class xSpriteAnimation : public xSprite, public xOrchestrable { public: // spritesheet with sprite size xSpriteAnimation(const char *url, SDL_Rect dest); xSpriteAnimation(SDL_Surface *s, SDL_Rect dest); ~xSpriteAnimation(); void addFrame(SDL_Rect clip); void clearFrames(); // animation control handles void start(uint32_t delay); void stop(); // implement xElement void draw(SDL_Renderer* renderer) override; // implement xOrchestrable void tick(const uint32_t ticks); protected: vector _frames; mutex _mutex_frames; // animation uint32_t _interval; }; #endif