Cocos2d. The right mix?

I changed the standard Hello World example:

        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];

I got:

image enter image description here

How to remove / cut background around Hello World tag?

+5
source share
1 answer

My current solution is to initialize CCLabelTTF with something like this:

CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64 dimensions:size hAlignment:kCCTextAlignmentCenter vAlignment:kCCVerticalTextAlignmentCenter];

where size [CCDirector sharedDirector] .winSize for my example.

Any other suggestions are welcome.

+3
source

All Articles