用Spine导出的 .atlas .json .png三个文件加入项目中,
然后根据:
m_pSkeletonNode = CCSkeletonAnimation::createWithFile("Spine/spineboy.json", "Spine/spineboy.atlas");
m_pSkeletonNode->setMix("walk", "jump", 0.4f);
m_pSkeletonNode->setMix("jump", "walk", 0.4f);
m_pSkeletonNode->setAnimation("walk", true);
m_pSkeletonNode->timeScale = 0.3f;
m_pSkeletonNode->debugBones = true;
m_pSkeletonNode->runAction(CCRepeatForever::create(CCSequence::create(CCFadeOut::create(1),CCFadeIn::create(1),CCDelayTime::create(5),NULL)));
CCSize windowSize = CCDirector::sharedDirector()->getWinSize();
m_pSkeletonNode->setPosition(ccp(windowSize.width / 2, 20));
addChild(m_pSkeletonNode);
这点代码准备运行一下这个Demo;
然后奇迹的事情发生了;
代码Crash在了:1 ,CCAssert(m_uReference > 0, "reference count should greater than 0");
2, void _AtlasPage_disposeTexture (AtlasPage* self) {
((CCTextureAtlas*)self->rendererObject)->release();
}
因为第一次使用Spine,还请会的朋友指点一下。
会不会是cocos2dx读取对应的Spine文件 版本不一致造成的。这个只是我的一个猜测。
我试过用2.1.5 2.2.5 3.0这几个版本都出现了这样的问题。
求助~