diff --git a/spine-cocos2dx/example/Classes/ExampleLayer.cpp b/spine-cocos2dx/example/Classes/ExampleLayer.cpp index 519a9cecd..028826818 100644 --- a/spine-cocos2dx/example/Classes/ExampleLayer.cpp +++ b/spine-cocos2dx/example/Classes/ExampleLayer.cpp @@ -42,7 +42,6 @@ bool ExampleLayer::init () { if (!CCLayer::init()) return false; skeletonNode = new CCSkeletonAnimation("spineboy.json", "spineboy.atlas"); - skeletonNode->addAnimationState(); skeletonNode->setMix("walk", "jump", 0.2f); skeletonNode->setMix("jump", "walk", 0.4f); diff --git a/spine-cocos2dx/src/spine/CCSkeleton.cpp b/spine-cocos2dx/src/spine/CCSkeleton.cpp index efc471ef3..0e312343c 100644 --- a/spine-cocos2dx/src/spine/CCSkeleton.cpp +++ b/spine-cocos2dx/src/spine/CCSkeleton.cpp @@ -219,11 +219,7 @@ CCRect CCSkeleton::boundingBox () { maxY = max(maxY, quad.tr.vertices.y * scaleY); } CCPoint position = getPosition(); - minX = position.x + minX; - minY = position.y + minY; - maxX = position.x + maxX; - maxY = position.y + maxY; - return CCRectMake(minX, minY, maxX - minX, maxY - minY); + return CCRectMake(position.x + minX, position.y + minY, maxX - minX, maxY - minY); } // CCBlendProtocol diff --git a/spine-cocos2dx/src/spine/CCSkeletonAnimation.cpp b/spine-cocos2dx/src/spine/CCSkeletonAnimation.cpp index ae9563d7f..ddeb24230 100644 --- a/spine-cocos2dx/src/spine/CCSkeletonAnimation.cpp +++ b/spine-cocos2dx/src/spine/CCSkeletonAnimation.cpp @@ -54,14 +54,17 @@ CCSkeletonAnimation* CCSkeletonAnimation::createWithFile (const char* skeletonDa CCSkeletonAnimation::CCSkeletonAnimation (SkeletonData *skeletonData) : CCSkeleton(skeletonData) { + addAnimationState(); } CCSkeletonAnimation::CCSkeletonAnimation (const char* skeletonDataFile, Atlas* atlas, float scale) : CCSkeleton(skeletonDataFile, atlas, scale) { + addAnimationState(); } CCSkeletonAnimation::CCSkeletonAnimation (const char* skeletonDataFile, const char* atlasFile, float scale) : CCSkeleton(skeletonDataFile, atlasFile, scale) { + addAnimationState(); } CCSkeletonAnimation::~CCSkeletonAnimation () { @@ -113,7 +116,7 @@ void CCSkeletonAnimation::setAnimationStateData (AnimationStateData* stateData, AnimationState_dispose(state); state = AnimationState_create(stateData); - states.push_back(state); + states[stateIndex] = state; } void CCSkeletonAnimation::setMix (char* fromAnimation, char* toAnimation, float duration, int stateIndex) {