Customizing the method
Circle.h
1 //2 //Circle.h3 //L01drawingapi4 //5 //Created by Mac OS 10.9.3 on 15-3-30.6 //7 //8 9 #ifndef __l01drawingapi__circle__Ten #define__l01drawingapi__circle__ One A#include <iostream> -#include <cocos2d.h> - the using namespacecocos2d; - - namespaceBobo { - + classCircle: Publicnode{ - + Public: A at Virtual BOOLinit (); - Virtual voidDraw (); - Create_func (Circle); - - }; - } in - #endif/* Defined (__l01drawingapi__circle__) */
Circle.cpp
1 //2 //Circle.cpp3 //L01drawingapi4 //5 //Created by Mac OS 10.9.3 on 15-3-30.6 //7 //8 9#include"Circle.h"Ten One namespaceBobo { A - BOOLCircle::init () { - return true; the } - - voidCircle::d Raw () { - + //float ScaleX, float ScaleY refers to the scaling of the X, Y axis - //drawprimitives::d rawcircle (const cocos2d::P oint ¢er, float radius, + //float angle, unsigned int segments, A //bool Drawlinetocenter, float ScaleX, at //float ScaleY); - - //Draw a circle, (center, RADIUS, angle (in radians, now 360 degrees), - //number of edges, whether to draw a line connected to the center of the circle) - //the number of sides is just a few sides of the shape - //drawprimitives::d rawcircle (Point (0, 0), M_PI * 2, 3, true); in //drawprimitives::d rawcircle (Point (0, 0), M_PI * 2, 5, true); -Drawprimitives::d rawcircle (Point (0,0), -, M_PI *2, -,true); to } +}
In the bool Helloworld::init ()
Auto C = bobo::circle::create ();
C->setposition (Point (400, 100));
AddChild (c);
Cocos2d-x of the Drawing circle