RAZVOR RAZVOR - 4 years ago 88
C++ Question

How to draw simple rect with cocos2d-x v3.0

In cocos2d-x 3.0 dont work ccDrawSolidRect. 3.0 api have class Rect, but i cant find documentation about it. How to draw simple color rect with cocos2d-x 3.0?

Answer Source

You can use void drawRect( Point origin, Point destination ); declared in CCDrawingPrimitives.

Call this method inside draw() method of any subclass of CCNode like:

void TestNode::draw() {
    drawRect(Point::Point(10,10), Point::Point(40,40));
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download