#ifndef DEF_XSPRITE_H #define DEF_XSPRITE_H #include #include #include #include "SDL.h" #include "SDL_image.h" #include "xDrawable.h" #include "xApplication.h" using namespace std; class xSprite : public xDrawable{ public: // color sprite xSprite(const int rgba[]); // image sprite xSprite(const char *url); // image with default clip xSprite(const char *url, SDL_Rect clip); virtual ~xSprite(); // replace surface void setSurface(const int rgba[]); // color sprite void setSurface(const char *url); // image sprite void setSurface(SDL_Surface *t); // copy surface // sets the sprite clip void setClip(SDL_Rect clip); // set projection into scene void project(SDL_Rect dest); // implement xDrawable virtual void draw(SDL_Renderer* renderer) override; private: SDL_Surface* _surface = NULL; SDL_Rect _clip; SDL_Rect _projection; mutex _mutex; }; #endif