I need to draw indented(concave) solid polygon with some vertices. I use
void HelloWorld::draw(void)
{
CCPoint vertices[5] = {ccp(200, 200), ccp(400, 400), ccp(200, 600), ccp(500, 600), ccp(500, 200)};
ccDrawSolidPoly(vertices, 5, ccc4f(0.7f, 0.7f, 0.7f, 0.5f));
}
And get Rectangle with triangle inside. But I expect indented(concave) solid polygon as in the picture
Try using drawPolygon function in CCDrawNode
void drawPolygon(CCPoint* verts, unsigned int count, const ccColor4F &fillColor,
float borderWidth, const ccColor4F& borderColor)
here is an example
CCPoint vertices[5] = {ccp(200, 200), ccp(400, 400), ccp(200, 600), ccp(500, 600), ccp(500, 200)};
CCDrawNode* polygon = CCDrawNode::create();
//creating red polygon with thin black border
polygon->drawPolygon(vertices, 5, ccc4f(1, 0, 0, 1), 1, ccc4f(0, 0, 0, 1));
addChild(polygon);
I hope it works