#pragma once #include #include #include using Clock = std::chrono::high_resolution_clock; using TimeStamp = std::chrono::time_point; struct SDL_Texture; struct SDL_Renderer; struct Sprite { explicit Sprite( SDL_Renderer* renderer, const std::string& filename, const int width ); virtual ~Sprite(); public: /*! * \brief rect - choose the sprite rect from the texture by index * \param idx - index of sprite * \return */ SDL_Rect rect(const int idx) const; public: /*! * \brief texture - the image is to be stored here */ SDL_Texture* texture{nullptr}; /*! * \brief width - single sprite width (texture width = width * nframes) */ int width{0}; /*! * \brief height - sprite height */ int height{0}; /*! * \brief nframes - number of frames in the animation sequence */ int nframes{0}; };