Browse Source

Clean up.

NathanSweet 12 years ago
parent
commit
35b45a564b

+ 0 - 1
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);
 

+ 1 - 5
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

+ 4 - 1
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) {