void AnimationAffector::end(long long dt, long long age) { W_UNUSED(dt); W_UNUSED(age); if(priv->restoreOriginal) { sprite->texture(priv->originalTexture); sprite->frame(priv->originalFrame.x(), priv->originalFrame.y()); } else { AnimationFrame f = priv->animation->last(); sprite->texture(f.texture()); sprite->frame(f.frame().x(), f.frame().y()); } }
void AnimationAffector::animate(long long dt, long long age) { W_UNUSED(age); priv->dt += dt; while(priv->dt > priv->animation->delay() && priv->currentFrame < priv->animation->frames()) { AnimationFrame f = priv->animation->frame(priv->currentFrame); sprite->texture(f.texture()); sprite->frame(f.frame().x(), f.frame().y()); priv->currentFrame++; priv->dt -= priv->animation->delay(); } }