Im using DrawNode as recommended to draw polygon but the problem its not drawn right as i like.
i attaching the images of the desired polygon shape and one that is output of my code that output wrong . the code :
if (sprite && sprite->init())
{
sprite->setTextureRect( Rect(0, 0, 200 ,200) );
sprite->autorelease();
auto draw = DrawNode::create();
{
Point Block1[] = {
Point(0,0),
Point(30,0),
Point(50,10),
Point(80,10),
Point(100,0),
Point(200,0),
Point(200,40),
Point(100,40),
Point(80,50),
Point(50,50),
Point(30,40),
Point(0,40)
};
draw->drawPolygon(Block1,12 ,Color4F(1,222,120,1), 1, Color4F(0,0,1,1));
}
sprite->addChild(draw, 10);
}
else
{
CC_SAFE_DELETE(sprite);
}
polygone.png (3.6 KB)
polygone_right.png (0.4 KB)