blubee
May 27, 2015, 2:50pm
#1
I am trying to draw primitives in cocos 2dx v3.6 but it seems that ccdrawlines is depreciated as well as trying to do
cocos2d::DrawPrimitives::drawLine(Vec2(0,150), Vec2(400,150));
Since it seems that these primitive drawing tools have been depreciated, how can I draw lines, polygons, etc…?
Look into DrawNode
class.
ppl
May 28, 2015, 1:29am
#3
The draw primitives have been replaced by the DrawNode
class as pointed out by @smitpatel88 . You can use the DrawNode
by adding the following code to one of your init
method of a Node
:
auto drawnode = DrawNode::create();
drawnode->drawLine(Vec2(0,0), Vec2(500,500), Color4F(1.0, 0.0, 0.0, 1.0));
addChild(drawnode);
It is interesting to note that the width of the line is not customizable in DrawNode
and is set to 1
regardless of the scale factor.
1 Like
blubee
May 28, 2015, 9:48am
#4
Hi guys, than you all, DrawNode is exactly what I was looking for.