Question

I modified standard example "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];

I got:

image enter image description here

How to delete/cut a background around "Hello World" label?

Was it helpful?

Solution

my current solution is to init CCLabelTTF something like this:

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

where size is [CCDirector sharedDirector].winSize for my examle.

any other suggestions are welcome

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top