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
How to delete/cut a background around "Hello World" label?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With