NEWSkeletonAnimation* skeletonNode;
skeletonNode = NEWSkeletonAnimation::createWithFile("Maid.json", "Maid.atlas", 0.6f); skeletonNode->startListener = [this] (int trackIndex) { spTrackEntry* entry = spAnimationState_getCurrent(skeletonNode->state, trackIndex); const char* animationName = (entry && entry->animation) ? entry->animation->name : 0; log("%d start: %s", trackIndex, animationName); }; skeletonNode->endListener = [=] (int trackIndex) { log("%d end", trackIndex); m_isSkeletonSiwtch = false; }; skeletonNode->completeListener = [] (int trackIndex, int loopCount) { log("%d complete: %d", trackIndex, loopCount); }; skeletonNode->eventListener = [] (int trackIndex, spEvent* event) { log("%d event: %s, %d, %f, %s", trackIndex, event->data->name, event->intValue, event->floatValue, event->stringValue); }; skeletonNode->setPosition(100, 100); this->addChild(skeletonNode); //skeletonNode->setAnimation(0, "Event", false);
时间: 2024-11-10 13:22:23