void Sprite::setAnimation(string name) { auto seq = anims.find(name); if(seq == anims.end()) return; currentAnim = &seq->second; setFrameRange(currentAnim->frameStart, currentAnim->frameEnd); setLooped(currentAnim->loop); animState = AnimState::STOPPED; }
bool GAFAnimation::playSequence(const char * name, bool looped, bool _resume, AnimSetSequenceHint hint) { if (!m_asset) { return false; } if (!name) { return false; } int s = getStartFrame(name); int e = getEndFrame(name); if (-1 == s || -1 == e) { return false; } m_currentSequenceStart = s; m_currentSequenceEnd = e; if (_currentFrameIndex < m_currentSequenceStart || _currentFrameIndex >m_currentSequenceEnd) { _currentFrameIndex = m_currentSequenceStart; } else { if (hint == ASSH_RESTART) { _currentFrameIndex = m_currentSequenceStart; } else { // new hints may appear } } setLooped(looped); if (_resume) { resumeAnimation(); } else { stop(); } return true; }
bool GAFObject::playSequence(const std::string& name, bool looped, bool resume /*= true*/) { if (!m_asset || !m_timeline) { return false; } if (name.empty()) { return false; } uint32_t s = getStartFrame(name); uint32_t e = getEndFrame(name); if (IDNONE == s || IDNONE == e) { return false; } m_currentSequenceStart = s; m_currentSequenceEnd = e; m_currentFrame = m_isReversed ? (e - 1) : (s); setLooped(looped, false); if (resume) { resumeAnimation(); } else { stop(); } return true; }
void AnimatedDrawable::play(Animation animation, sf::Int16 offset) { setLooped(animation.m_loop); play(animation.m_startFrame, animation.m_endFrame, offset); }
Path::Path() { setFirstControlPoint(ControlPoint()); setLastControlPoint(ControlPoint()); setLooped(false); }
Path::Path(ControlPoint start, ControlPoint end, bool looped) { setFirstControlPoint(start); setLastControlPoint(end); setLooped(looped); }