#include "animatedtexture.h" #include "graphics.h" #include #include #include AnimatedTexture::AnimatedTexture(int width, int height, int channels, int numFrames, uchar *framesPixels, int *framesDelay) : Texture(), m_numFrames(numFrames) { m_size.setSize(width, height); m_framesTextureId.resize(numFrames); m_framesDelay.resize(numFrames); for(int i=0;i= m_numFrames) m_currentFrame = 0; m_textureId = m_framesTextureId[m_currentFrame]; AnimatedTexturePtr me = std::static_pointer_cast(shared_from_this()); if(me.use_count() > 1) g_dispatcher.scheduleEvent(std::bind(&AnimatedTexture::processAnimation, me), m_framesDelay[m_currentFrame]); }