Reputation: 1
I want to draw several filled square using Coco2d v3
where the color is filled programmatically and has a border.
I have tried this code from a post, but it isn't working. The blank is a transparent 1*1 pixel image .
-(CCSprite *) rectangleSpriteWithSize:(CGSize)cgsize color:(CCColor*) c
{
CCSprite *sg = [CCSprite spriteWithImageNamed:@"Blank.png"];
[sg setTextureRect:CGRectMake( 0, 0, cgsize.width, cgsize.height)];
[sg setColor:c];
return sg;
}
Upvotes: 0
Views: 1214
Reputation: 9089
try a CCNodeColor :
-(CCNode*) rectangleSpriteWithSize:(CGSize)size color:(CCColor*) c {
CCNodeColor *nc = [CCNodeColor nodeWithColor:c width:size.width height:size.height];
return nc;
}
Upvotes: 1