Hello.
I am using the animation system from the thor library and I have problems making a fade animation.
I got this sprite in a class together with a thor::animator<sf::sprite, std::string>. The problem is when I create the connection between the animator and the fade function. As you can see I print output to the console just to see if I am in there but I never get there. Do you know why? Is my bind correct?
m_animator.addAnimation("fade", std::bind(&LightningBolt::fade, this, std::placeholders::_1, std::placeholders::_2), m_fadeDuration);
And here is the method:
void fade(sf::Sprite& animated, float progress)
{
printf("progress %f", progress);
int alpha = int((1.f - progress) * 255.f);
animated.setColor(sf::Color(255, 255, 255, alpha));
if (alpha == 0)
{
m_canDie = true;
}
}
And I start it like this:
m_animator.playAnimation("fade", false);