Browse Source

Added CCBlendProtocol.

NathanSweet 12 years ago
parent
commit
9cda83aba8

+ 2 - 3
spine-cocos2d-iphone/src/spine/spine-cocos2d-iphone.h

@@ -44,7 +44,7 @@ typedef struct {
 	CCSkeleton* node;
 } Cocos2dSkeleton;
 
-@interface CCSkeleton : CCNodeRGBA {
+@interface CCSkeleton : CCNodeRGBA<CCBlendProtocol> {
 @public
 	Skeleton* skeleton;
 	AnimationState* state;
@@ -52,6 +52,7 @@ typedef struct {
 	bool debugBones;
 	CCTextureAtlas* atlas; // All region attachments for a skeleton must use the same texture.
 	unsigned int quadCount;
+    ccBlendFunc blendFunc;
 }
 
 + (CCSkeleton*) create:(SkeletonData*)skeletonData;
@@ -59,8 +60,6 @@ typedef struct {
 - init:(SkeletonData*)skeletonData;
 - init:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData;
 
-// CCBlendProtocol
-//CC_PROPERTY(ccBlendFunc, blendFunc, BlendFunc);
 @end
 
 /**/

+ 8 - 9
spine-cocos2d-iphone/src/spine/spine-cocos2d-iphone.m

@@ -83,8 +83,8 @@ Skeleton* _Cocos2dSkeleton_create (SkeletonData* data, CCSkeleton* node) {
 	skeleton = _Cocos2dSkeleton_create(skeletonData, self);
 	state = AnimationState_create(stateData);
 
-	/*blendFunc.src = GL_ONE;
-	blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;*/
+	blendFunc.src = GL_ONE;
+	blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
 
 	[self setShaderProgram:[[CCShaderCache sharedShaderCache] programForKey:kCCShader_PositionTextureColor]];
 	[self scheduleUpdate];
@@ -108,7 +108,7 @@ Skeleton* _Cocos2dSkeleton_create (SkeletonData* data, CCSkeleton* node) {
 - (void) draw {
 	CC_NODE_DRAW_SETUP();
 
-	//ccGLBlendFunc(blendFunc.src, blendFunc.dst);
+	ccGLBlendFunc(blendFunc.src, blendFunc.dst);
 	ccColor3B color = self.color;
 	skeleton->r = color.r / (float)255;
 	skeleton->g = color.g / (float)255;
@@ -157,15 +157,14 @@ Skeleton* _Cocos2dSkeleton_create (SkeletonData* data, CCSkeleton* node) {
 }
 
 // CCBlendProtocol
-/*
-ccBlendFunc CCSkeleton::getBlendFunc () {
-    return blendFunc;
+
+- (void) setBlendFunc:(ccBlendFunc)blendFunc {
+    self.blendFunc = blendFunc;
 }
 
-void CCSkeleton::setBlendFunc (ccBlendFunc blendFunc) {
-    this->blendFunc = blendFunc;
+- (ccBlendFunc) blendFunc {
+    return blendFunc;
 }
-*/
 
 @end