cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cocos2d::DrawPrimitives Namespace Reference

Functions

void CC_DLL init ()
 Initializes the drawing primitives. More...
 
void CC_DLL free ()
 Frees allocated resources by the drawing primitives. More...
 
void CC_DLL drawPoint (const Vec2 &point)
 draws a point given x and y coordinate measured in points More...
 
void CC_DLL drawPoints (const Vec2 *points, unsigned int numberOfPoints)
 draws an array of points. More...
 
void CC_DLL drawLine (const Vec2 &origin, const Vec2 &destination)
 draws a line given the origin and destination point measured in points More...
 
void CC_DLL drawRect (Vec2 origin, Vec2 destination)
 draws a rectangle given the origin and destination point measured in points. More...
 
void CC_DLL drawSolidRect (Vec2 origin, Vec2 destination, Color4F color)
 draws a solid rectangle given the origin and destination point measured in points. More...
 
void CC_DLL drawPoly (const Vec2 *vertices, unsigned int numOfVertices, bool closePolygon)
 draws a polygon given a pointer to point coordinates and the number of vertices measured in points. More...
 
void CC_DLL drawSolidPoly (const Vec2 *poli, unsigned int numberOfPoints, Color4F color)
 draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color. More...
 
void CC_DLL drawCircle (const Vec2 &center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY)
 draws a circle given the center, radius and number of segments. More...
 
void CC_DLL drawCircle (const Vec2 &center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
 
void CC_DLL drawSolidCircle (const Vec2 &center, float radius, float angle, unsigned int segments, float scaleX, float scaleY)
 draws a solid circle given the center, radius and number of segments. More...
 
void CC_DLL drawSolidCircle (const Vec2 &center, float radius, float angle, unsigned int segments)
 
void CC_DLL drawQuadBezier (const Vec2 &origin, const Vec2 &control, const Vec2 &destination, unsigned int segments)
 draws a quad bezier path More...
 
void CC_DLL drawCubicBezier (const Vec2 &origin, const Vec2 &control1, const Vec2 &control2, const Vec2 &destination, unsigned int segments)
 draws a cubic bezier path More...
 
void CC_DLL drawCatmullRom (PointArray *arrayOfControlPoints, unsigned int segments)
 draws a Catmull Rom path. More...
 
void CC_DLL drawCardinalSpline (PointArray *config, float tension, unsigned int segments)
 draws a Cardinal Spline path. More...
 
void CC_DLL setDrawColor4B (GLubyte r, GLubyte g, GLubyte b, GLubyte a)
 set the drawing color with 4 unsigned bytes More...
 
void CC_DLL setDrawColor4F (GLfloat r, GLfloat g, GLfloat b, GLfloat a)
 set the drawing color with 4 floats More...
 
void CC_DLL setPointSize (GLfloat pointSize)
 set the point size in points. More...
 

Function Documentation

void CC_DLL cocos2d::DrawPrimitives::drawCardinalSpline ( PointArray *  config,
float  tension,
unsigned int  segments 
)

draws a Cardinal Spline path.

Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v2.0
void CC_DLL cocos2d::DrawPrimitives::drawCatmullRom ( PointArray *  arrayOfControlPoints,
unsigned int  segments 
)

draws a Catmull Rom path.

Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v2.0
void CC_DLL cocos2d::DrawPrimitives::drawCircle ( const Vec2 center,
float  radius,
float  angle,
unsigned int  segments,
bool  drawLineToCenter,
float  scaleX,
float  scaleY 
)

draws a circle given the center, radius and number of segments.

void CC_DLL cocos2d::DrawPrimitives::drawCircle ( const Vec2 center,
float  radius,
float  angle,
unsigned int  segments,
bool  drawLineToCenter 
)
void CC_DLL cocos2d::DrawPrimitives::drawCubicBezier ( const Vec2 origin,
const Vec2 control1,
const Vec2 control2,
const Vec2 destination,
unsigned int  segments 
)

draws a cubic bezier path

Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v0.8
void CC_DLL cocos2d::DrawPrimitives::drawLine ( const Vec2 origin,
const Vec2 destination 
)

draws a line given the origin and destination point measured in points

void CC_DLL cocos2d::DrawPrimitives::drawPoint ( const Vec2 point)

draws a point given x and y coordinate measured in points

void CC_DLL cocos2d::DrawPrimitives::drawPoints ( const Vec2 points,
unsigned int  numberOfPoints 
)

draws an array of points.

Since
v0.7.2
void CC_DLL cocos2d::DrawPrimitives::drawPoly ( const Vec2 vertices,
unsigned int  numOfVertices,
bool  closePolygon 
)

draws a polygon given a pointer to point coordinates and the number of vertices measured in points.

The polygon can be closed or open

void CC_DLL cocos2d::DrawPrimitives::drawQuadBezier ( const Vec2 origin,
const Vec2 control,
const Vec2 destination,
unsigned int  segments 
)

draws a quad bezier path

Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v0.8
void CC_DLL cocos2d::DrawPrimitives::drawRect ( Vec2  origin,
Vec2  destination 
)

draws a rectangle given the origin and destination point measured in points.

void CC_DLL cocos2d::DrawPrimitives::drawSolidCircle ( const Vec2 center,
float  radius,
float  angle,
unsigned int  segments,
float  scaleX,
float  scaleY 
)

draws a solid circle given the center, radius and number of segments.

void CC_DLL cocos2d::DrawPrimitives::drawSolidCircle ( const Vec2 center,
float  radius,
float  angle,
unsigned int  segments 
)
void CC_DLL cocos2d::DrawPrimitives::drawSolidPoly ( const Vec2 poli,
unsigned int  numberOfPoints,
Color4F  color 
)

draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color.

void CC_DLL cocos2d::DrawPrimitives::drawSolidRect ( Vec2  origin,
Vec2  destination,
Color4F  color 
)

draws a solid rectangle given the origin and destination point measured in points.

Since
1.1
void CC_DLL cocos2d::DrawPrimitives::free ( )

Frees allocated resources by the drawing primitives.

void CC_DLL cocos2d::DrawPrimitives::init ( )

Initializes the drawing primitives.

void CC_DLL cocos2d::DrawPrimitives::setDrawColor4B ( GLubyte  r,
GLubyte  g,
GLubyte  b,
GLubyte  a 
)

set the drawing color with 4 unsigned bytes

Since
v2.0
void CC_DLL cocos2d::DrawPrimitives::setDrawColor4F ( GLfloat  r,
GLfloat  g,
GLfloat  b,
GLfloat  a 
)

set the drawing color with 4 floats

Since
v2.0
void CC_DLL cocos2d::DrawPrimitives::setPointSize ( GLfloat  pointSize)

set the point size in points.

Default 1.

Since
v2.0