Actor::Actor(const Point& position, const AnimationCollection& animations, const String& currentAnimation): animations_(animations), currAnimation_(currentAnimation), rect_(position, animations.animation(currentAnimation).size()), updater_(std::bind(&Actor::updatedFrameFromCurrentAnimation, this, std::placeholders::_1, std::placeholders::_2)) { ASSERT(!currAnimation_.empty(), "current animation name is empty"); }
Texture Actor::updatedFrameFromCurrentAnimation(AnimationCollection& animations, std::chrono::milliseconds elapsed) { auto& currAnim = animations.animation(currAnimation_); currAnim.update(elapsed); return currAnim.currentFrame(); }