#ifndef DEF_XSPRITEGROUP_H #define DEF_XSPRITEGROUP_H #include #include #include #include "SDL.h" #include "SDL_image.h" #include "xDrawable.h" #include "xOrchestrable.h" #include "xApplication.h" #include "xSprite.h" using namespace std; class xSpriteGroup : public xDrawable, public xOrchestrable { public: xSpriteGroup(); virtual ~xSpriteGroup(); // manage sprite list void add(xSprite* sprite); void remove(xSprite* sprite); void clear(); // set absolute move for each sprite void displace(SDL_Rect displace); void displace(int x, int y, int w, int h); // implement xDrawable virtual void draw(SDL_Renderer* renderer) override; // implement xOrchestrable void tick(const uint32_t ticks); // animation handles void animate(uint32_t interval); void freeze(); protected: void draw_sprite(SDL_Renderer* renderer, xSprite* sprite); SDL_Rect _displace; set _sprites; // if not animated, draw all sprites, else draw one at a time bool _animated = false; // active sprite for animation size_t _active_sprite = 0; uint32_t _animation_interval = 0; mutex _mutex; }; #endif