cocos2dx spine骨骼动画

        #include 
        #include "spine/spine.h"

        auto ske = resroot + "default.json";
        auto atl = resroot + "default.atlas";

        // 骨骼动画
        auto animi = spine::SkeletonAnimation::createWithFile(ske, atl);
        animi->setPosition(node->getPosition());
        node->getParent()->addChild(animi);
        animi->setAnimation(0, "animation", true);

        animi->setCompleteListener([animi](int trackIndex, int loopCount)
        {
            CCLOG("trackIndex: %d, loopCount: %d", trackIndex, loopCount);
            if (loopCount == 3)
            {
                // 只能异步移除
                animi->runAction(RemoveSelf::create());
            }
        });

你可能感兴趣的:(cocos2dx spine骨骼动画)