std::string SpineDrawable::getAnimationName(int32_t trackIndex) const { if (spTrackEntry* current = spAnimationState_getCurrent(animationState, trackIndex)) { if (current->animation) return current->animation->name; } return std::string(); }
float SpineDrawable::getAnimationProgress(int32_t trackIndex) const { if (spTrackEntry* current = spAnimationState_getCurrent(animationState, trackIndex)) { return (current->trackEnd != 0.0f) ? current->trackTime / current->trackEnd : 0.0f; } return 0.0f; }
bool SpineDrawable::setAnimationProgress(int32_t trackIndex, float progress) { if (spTrackEntry* current = spAnimationState_getCurrent(animationState, trackIndex)) { current->trackTime = current->trackEnd * progress; } return true; }
std::string SpineDrawable::getAnimation(int32_t trackIndex) const { spTrackEntry* track = spAnimationState_getCurrent(animationState, trackIndex); if (track && track->animation) { return track->animation->name; } return ""; }
void IFFieldMonsterNode::animationStateEvent(int trackIndex, int loopCount) { spTrackEntry* entry = spAnimationState_getCurrent(animationObj->getState(), trackIndex); if(m_callBack && entry) { if(loopCount == m_loopCnt) { m_callBack->execute(); CC_SAFE_RELEASE_NULL(m_callBack); } } }
UTrackEntry* USpineSkeletonAnimationComponent::GetCurrent (int trackIndex) { CheckState(); if (state) { spTrackEntry* entry = spAnimationState_getCurrent(state, trackIndex); if (entry->rendererObject) { return (UTrackEntry*)entry->rendererObject; } else { UTrackEntry* uEntry = NewObject<UTrackEntry>(); uEntry->SetTrackEntry(entry); trackEntries.Add(uEntry); return uEntry; } } else return NewObject<UTrackEntry>(); }
void SkeletonAnimation::onTrackEntryEvent (int trackIndex, spEventType type, spEvent* event, int loopCount) { spTrackEntry* entry = spAnimationState_getCurrent(_state, trackIndex); if (!entry->rendererObject) return; _TrackEntryListeners* listeners = (_TrackEntryListeners*)entry->rendererObject; switch (type) { case SP_ANIMATION_START: if (listeners->startListener) listeners->startListener(trackIndex); break; case SP_ANIMATION_END: if (listeners->endListener) listeners->endListener(trackIndex); break; case SP_ANIMATION_COMPLETE: if (listeners->completeListener) listeners->completeListener(trackIndex, loopCount); break; case SP_ANIMATION_EVENT: if (listeners->eventListener) listeners->eventListener(trackIndex, event); break; } }
void WIPAnimator::callback (spAnimationState* state, int trackIndex, spEventType type, spEvent* event, int loopCount) { spTrackEntry* entry = spAnimationState_getCurrent(state, trackIndex); const char* animationName = (entry && entry->animation) ? entry->animation->name : 0; char outstr[64]; switch (type) { case SP_ANIMATION_START: sprintf(outstr,"%d start: %s\n", trackIndex, animationName); break; case SP_ANIMATION_END: sprintf(outstr,"%d end: %s\n", trackIndex, animationName); break; case SP_ANIMATION_COMPLETE: sprintf(outstr,"%d complete: %s, %d\n", trackIndex, animationName, loopCount); break; case SP_ANIMATION_EVENT: sprintf(outstr,"%d event: %s, %s: %d, %f, %s\n", trackIndex, animationName, event->data->name, event->intValue, event->floatValue, event->stringValue); break; } //printf(outstr); //fflush(stdout); }
spTrackEntry* SkeletonAnimation::getCurrent (int trackIndex) { return spAnimationState_getCurrent(_state, trackIndex); }
spTrackEntry* SpineAnimation::getCurrent(int trackIndex) { return spAnimationState_getCurrent(state, trackIndex); }
const char* Skeleton::get_current_animation(int track) { spTrackEntry* entry = spAnimationState_getCurrent(state_, track); return (!entry ? nullptr : entry->animation->name); }