MCPcopy Create free account
hub / github.com/axmolengine/axmol / setDisplayFrameWithAnimationName

Method setDisplayFrameWithAnimationName

core/2d/Sprite.cpp:1602–1617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1600}
1601
1602void Sprite::setDisplayFrameWithAnimationName(std::string_view animationName, unsigned int frameIndex)
1603{
1604 AXASSERT(!animationName.empty(), "CCSprite#setDisplayFrameWithAnimationName. animationName must not be nullptr");
1605 if (animationName.empty())
1606 return;
1607
1608 Animation* a = AnimationCache::getInstance()->getAnimation(animationName);
1609
1610 AXASSERT(a, "CCSprite#setDisplayFrameWithAnimationName: Frame not found");
1611
1612 AnimationFrame* frame = a->getFrames().at(frameIndex);
1613
1614 AXASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame");
1615
1616 setSpriteFrame(frame->getSpriteFrame());
1617}
1618
1619bool Sprite::isFrameDisplayed(SpriteFrame* frame) const
1620{

Callers

nothing calls this directly

Calls 6

getInstanceFunction · 0.85
setSpriteFrameFunction · 0.85
getSpriteFrameMethod · 0.80
emptyMethod · 0.45
getAnimationMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected