[cocos2dx] Added SkeletonAnimation::findAnimation, closes #285

This commit is contained in:
badlogic 2016-07-18 17:01:47 +02:00
parent 0d66cf3458
commit ffafd67873
2 changed files with 5 additions and 0 deletions

View File

@ -166,6 +166,10 @@ spTrackEntry* SkeletonAnimation::addAnimation (int trackIndex, const std::string
return spAnimationState_addAnimation(_state, trackIndex, animation, loop, delay); return spAnimationState_addAnimation(_state, trackIndex, animation, loop, delay);
} }
spAnimation* SkeletonAnimation::findAnimation(const std::string& name) const {
return spSkeletonData_findAnimation(_skeleton->data, name.c_str());
}
spTrackEntry* SkeletonAnimation::getCurrent (int trackIndex) { spTrackEntry* SkeletonAnimation::getCurrent (int trackIndex) {
return spAnimationState_getCurrent(_state, trackIndex); return spAnimationState_getCurrent(_state, trackIndex);
} }

View File

@ -59,6 +59,7 @@ public:
spTrackEntry* setAnimation (int trackIndex, const std::string& name, bool loop); spTrackEntry* setAnimation (int trackIndex, const std::string& name, bool loop);
spTrackEntry* addAnimation (int trackIndex, const std::string& name, bool loop, float delay = 0); spTrackEntry* addAnimation (int trackIndex, const std::string& name, bool loop, float delay = 0);
spAnimation* findAnimation(const std::string& name) const;
spTrackEntry* getCurrent (int trackIndex = 0); spTrackEntry* getCurrent (int trackIndex = 0);
void clearTracks (); void clearTracks ();
void clearTrack (int trackIndex = 0); void clearTrack (int trackIndex = 0);