Cocos2d-x3.0 DrawNode画图

来源:互联网 发布:四宫格视频是什么软件 编辑:程序博客网 时间:2024/05/16 04:52

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);
效果:



0 0