#include "cinder/app/AppBase.h" #include "cinder/Surface.h" #include "cinder/ImageIo.h" #include "cinder/gl/Texture.h" typedef std::shared_ptr AnimatedGifRef; class AnimatedGif { public: AnimatedGif(){ init( nullptr ); }; AnimatedGif( ci::DataSourceRef filePath ){ init( filePath ); }; AnimatedGif( ci::DataSourceRef filePath, int frameRate ){ init( filePath, frameRate ); }; ~AnimatedGif() {}; void load( ci::DataSourceRef filePath ); void update(); ci::gl::TextureRef getCurrentFrame() { return mCurrentFrameTexture; }; void setFrameRate( int frameRate ) { mFrameRate = frameRate; }; private: std::vector mGifFrames; int mCurrentFrame; int mFrameRate; ci::gl::TextureRef mCurrentFrameTexture; void init( ci::DataSourceRef filePath = nullptr, int frameRate = 60 ); };