Search code examples
c++cocos2d-x

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?


Solution

  • 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));
    }