Ejemplo n.º 1
0
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");
	}
Ejemplo n.º 2
0
Texture Actor::updatedFrameFromCurrentAnimation(AnimationCollection& animations, std::chrono::milliseconds elapsed)
	{
	auto& currAnim = animations.animation(currAnimation_);
	currAnim.update(elapsed);
	return currAnim.currentFrame();
	}