Hi guys!
I have an array of 2D points which make an irregular polygon. What I want to do is draw the borders of it and then fill it with a color.
I am using Cocos2d to code the game around, but I have not found a fill function in Cocos2d, only the
ccDrawLine
and such.
Is there a simple way to draw filled shapes in Cocos2?
I have also noted that Core Graphics would work beautifully for this purpose, but I am not able to integrate it with Cocos2d. I put this in to the draw function of my CCLayer:
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextClearRect(ctx, [[UIScreen mainScreen] bounds]);
And every time I run it i get this error:
<Error>: CGContextClearRect: invalid context
I really need to get this working...
Any ideas?