cocos2d-iphone – cocos2d.正确混合?

前端之家收集整理的这篇文章主要介绍了cocos2d-iphone – cocos2d.正确混合?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
修改了标准示例“Hello World”:
CCSprite *sprite = [CCSprite spriteWithFile:@"Untitled-1.png"];
        CGSize winSize = [CCDirector sharedDirector].winSize;
        sprite.position = ccp(winSize.width / 2,winSize.height / 2);
        [label setBlendFunc:(ccBlendFunc){GL_ZERO,GL_SRC_ALPHA}];
        [label setColor:ccBLACK];
        [sprite addChild:label];
        [self addChild:sprite];

我有:

image

如何删除/剪切“Hello World”标签周围的背景?

我目前的解决方案是初始化CCLabelTTF:
CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64 dimensions:size hAlignment:kCCTextAlignmentCenter vAlignment:kCCVerticalTextAlignmentCenter];

其中size是[CCDirector sharedDirector] .winSize for my examle.

欢迎任何其他建议

猜你在找的Cocos2d-x相关文章