![Cocos2d-x3.0 DrawNode吸取 Cocos2d-x3.0 DrawNode吸取](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
DrawNode正如它的绘图形状的节点,相互作用可以使将来更加灵活。
DrawNode* DrawLayer::shape()
{
auto shape = DrawNode::create();
static Point triangle[3];
triangle[0] = Point(-100, -100);
triangle[1] = Point(100, -100);
triangle[2] = Point(0, 100); static Color4F green(0, 1, 0, 1);
shape->drawPolygon(triangle, 3, green, 0, green);
return shape; }
调用:
auto node = this->shape();
node->setPosition(Point(200, 300));
addChild(node);
效果:
版权声明:本文博主原创文章。博客,未经同意不得转载。