当前位置 : 主页 > 手机开发 > 其它 >

cocos2d-iphone – cocos2d.正确混合?

来源:互联网 收集:自由互联 发布时间:2021-06-13
我修改了标准示例“Hello World”: CCSprite *sprite = [CCSprite spriteWithFile:@"Untitled-1.png"]; CGSize winSize = [CCDirector sharedDirector].winSize; sprite.position = ccp(winSize.width / 2, winSize.height / 2); [label setBlend
我修改了标准示例“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.

欢迎任何其他建议

网友评论