How to draw circle or line in cocos2dx 3.0.
my code is
DrawNode *drawnode = DrawNode::create();
drawnode->drawDot(ccp(15,Director::sharedDirector()->getVisibleSize().height/2),50,Color4F(255,255,255,255));
this->addChild(drawnode);
to draw a line cocos2d-x has function drawsegment
a circle is special type of polygon so for circle drawpolygon function is used
// for line
draw->drawSegment(startPoint, moved, 5,Color4F(1,222,120,1) );
// for circle
static CCPoint Circle [nCount]; // vertex array
for ( int i = 0 ; i <nCount; i ++) {
float rads = i * coef; // radians
Circle [i] .x = Radius * cosf (rads); //vertex x
Circle [i] .y = Radius * sinf (rads); //vertex y
}
draw-> drawPolygon (Circle, nCount, blue, 0 , red);