Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cocos2d. Correct blending?

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?

like image 982
user2083364 Avatar asked Oct 22 '22 14:10

user2083364


1 Answers

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

like image 200
user2083364 Avatar answered Oct 30 '22 13:10

user2083364