开发者

Setting Text color for CCTexture2d initWithString

I am creating a CCTexture2d using initWithString. But how do I set the color for this text?

CCTexture2D* texture = [[CCTexture2D alloc] initWithString:labeltext fontName:@"Carlisle" fontSize:18];

(Cocos2d 99.5, XCode 3.2.5 BaseSDK 4.2 Objecti开发者_运维百科ve-C, Deployent OS 3.1.3)


do u mean something like [texture setColor:someColor]; where someColor is a ccColor3B


A colleague found out a solution that works for me:

unsigned long color = 0xFFFF0000;
CCSprite* sprite = <<get your sprite here>>;
sprite.color      = ccc3(GetR(color), GetG(color), GetB(color));

It sets the color for the sprite, not the texture, so it is not exactly what I was looking for, but it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜