Added CCBlendProtocol.

This commit is contained in:
NathanSweet 2013-04-02 05:24:25 +02:00
parent 567d076f78
commit 9cda83aba8
2 changed files with 10 additions and 12 deletions

View File

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

View File

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