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

Functions

void CC_DLL  ()
 Initializes the drawing primitives. More...
 
void CC_DLL  ()
 Frees allocated resources by the drawing primitives. More...
 
void CC_DLL  (const Vec2 &point)
 Draws a point given x and y coordinate measured in points. More...
 
local  ( local point)
 Draws a point given x and y coordinate measured in points. More...
 
void CC_DLL  (const Vec2 *points, unsigned int numberOfPoints)
 Draws an array of points. More...
 
void CC_DLL  (const Vec2 &origin, const Vec2 &destination)
 Draws a line given the origin and destination point measured in points. More...
 
void CC_DLL  (Vec2 origin, Vec2 destination)
 Draws a rectangle given the origin and destination point measured in points. More...
 
void CC_DLL  (Vec2 origin, Vec2 destination, Color4F color)
 Draws a solid rectangle given the origin and destination point measured in points. More...
 
void CC_DLL  (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  (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  (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...
 
local  ( local center, local radius, local angle, local segments, local drawLineToCenter, local scaleX, local scaleY)
 Draws a circle given the center, radius and number of segments. More...
 
void CC_DLL  (const Vec2 &center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
 Draws a circle given the center, radius and number of segments. More...
 
local  ( local center, local radius, local angle, local segments, local drawLineToCenter)
 Draws a circle given the center, radius and number of segments. More...
 
void CC_DLL  (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  (const Vec2 &center, float radius, float angle, unsigned int segments)
 Draws a solid circle given the center, radius and number of segments. More...
 
local  ( local center, local radius, local angle, local segments)
 Draws a solid circle given the center, radius and number of segments. More...
 
void CC_DLL  (const Vec2 &origin, const Vec2 &control, const Vec2 &destination, unsigned int segments)
 Draws a quad bezier path. More...
 
void CC_DLL  (const Vec2 &origin, const Vec2 &control1, const Vec2 &control2, const Vec2 &destination, unsigned int segments)
 Draws a cubic bezier path. More...
 
void CC_DLL  (PointArray *arrayOfControlPoints, unsigned int segments)
 Draws a Catmull Rom path. More...
 
void CC_DLL  (PointArray *config, float tension, unsigned int segments)
 Draws a Cardinal Spline path. More...
 
void CC_DLL  (GLubyte r, GLubyte g, GLubyte b, GLubyte a)
 Set the drawing color with 4 unsigned bytes. More...
 
void CC_DLL  (GLfloat r, GLfloat g, GLfloat b, GLfloat a)
 Set the drawing color with 4 floats. More...
 
void CC_DLL  (GLfloat pointSize)
 Set the point size in points. More...
 

Function Documentation

void CC_DLL
cocos2d::DrawPrimitives::init
( )

Initializes the drawing primitives.

var init ( )

Initializes the drawing primitives.

local init ( )

Initializes the drawing primitives.

void CC_DLL
cocos2d::DrawPrimitives::free
( )

Frees allocated resources by the drawing primitives.

var free ( )

Frees allocated resources by the drawing primitives.

local free ( )

Frees allocated resources by the drawing primitives.

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

Draws a point given x and y coordinate measured in points.

Parameters
pointA Vec2 with a point given x and y coordinate.
var drawPoint ( var  point)

Draws a point given x and y coordinate measured in points.

Parameters
pointA Vec2 with a point given x and y coordinate.
local drawPoint ( local  point)

Draws a point given x and y coordinate measured in points.

Parameters
pointA Vec2 with a point given x and y coordinate.
void CC_DLL
cocos2d::DrawPrimitives::drawPoints
( const Vec2 points,
unsigned int  numberOfPoints 
)

Draws an array of points.

Parameters
pointA point coordinates.
numberOfPointsThe number of points.
Since
v0.7.2
var drawPoints ( var  points,
var  numberOfPoints 
)

Draws an array of points.

Parameters
pointA point coordinates.
numberOfPointsThe number of points.
Since
v0.7.2
local drawPoints ( local  points,
local  numberOfPoints 
)

Draws an array of points.

Parameters
pointA point coordinates.
numberOfPointsThe number of points.
Since
v0.7.2
void CC_DLL
cocos2d::DrawPrimitives::drawLine
( const Vec2 origin,
const Vec2 destination 
)

Draws a line given the origin and destination point measured in points.

Parameters
originA Vec2 Type point used to the line origin.
destinationA Vec2 Type point used to the line destination.
var drawLine ( var  origin,
var  destination 
)

Draws a line given the origin and destination point measured in points.

Parameters
originA Vec2 Type point used to the line origin.
destinationA Vec2 Type point used to the line destination.
local drawLine ( local  origin,
local  destination 
)

Draws a line given the origin and destination point measured in points.

Parameters
originA Vec2 Type point used to the line origin.
destinationA Vec2 Type point used to the line destination.
void CC_DLL
cocos2d::DrawPrimitives::drawRect
( Vec2  origin,
Vec2  destination 
)

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

The origin and the destination can not have the same x and y coordinate.

Parameters
originThe rectangle origin.
destinationThe rectangle destination.
var drawRect ( var  origin,
var  destination 
)

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

The origin and the destination can not have the same x and y coordinate.

Parameters
originThe rectangle origin.
destinationThe rectangle destination.
local drawRect ( local  origin,
local  destination 
)

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

The origin and the destination can not have the same x and y coordinate.

Parameters
originThe rectangle origin.
destinationThe rectangle destination.
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.

The origin and the destination can not have the same x and y coordinate.

Parameters
originThe rectangle origin.
destinationThe rectangle destination.
colorThe rectangle color.
Since
1.1
var drawSolidRect ( var  origin,
var  destination,
var  color 
)

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

The origin and the destination can not have the same x and y coordinate.

Parameters
originThe rectangle origin.
destinationThe rectangle destination.
colorThe rectangle color.
Since
1.1
local drawSolidRect ( local  origin,
local  destination,
local  color 
)

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

The origin and the destination can not have the same x and y coordinate.

Parameters
originThe rectangle origin.
destinationThe rectangle destination.
colorThe rectangle color.
Since
1.1
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.

Parameters
verticesA pointer to point coordinates.
numOfVerticesThe number of vertices measured in points.
closePolygonThe polygon can be closed or open.
var drawPoly ( var  vertices,
var  numOfVertices,
var  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.

Parameters
verticesA pointer to point coordinates.
numOfVerticesThe number of vertices measured in points.
closePolygonThe polygon can be closed or open.
local drawPoly ( local  vertices,
local  numOfVertices,
local  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.

Parameters
verticesA pointer to point coordinates.
numOfVerticesThe number of vertices measured in points.
closePolygonThe polygon can be closed or open.
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.

Parameters
poliA solid polygon given a pointer to CGPoint coordinates.
numberOfPointsThe number of vertices measured in points.
colorThe solid polygon color.
var drawSolidPoly ( var  poli,
var  numberOfPoints,
var  color 
)

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

Parameters
poliA solid polygon given a pointer to CGPoint coordinates.
numberOfPointsThe number of vertices measured in points.
colorThe solid polygon color.
local drawSolidPoly ( local  poli,
local  numberOfPoints,
local  color 
)

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

Parameters
poliA solid polygon given a pointer to CGPoint coordinates.
numberOfPointsThe number of vertices measured in points.
colorThe solid polygon color.
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.

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
drawLineToCenterWhether or not draw the line from the origin to center.
scaleXThe scale value in x.
scaleYThe scale value in y.
var drawCircle ( var  center,
var  radius,
var  angle,
var  segments,
var  drawLineToCenter,
var  scaleX,
var  scaleY 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
drawLineToCenterWhether or not draw the line from the origin to center.
scaleXThe scale value in x.
scaleYThe scale value in y.
local drawCircle ( local  center,
local  radius,
local  angle,
local  segments,
local  drawLineToCenter,
local  scaleX,
local  scaleY 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
drawLineToCenterWhether or not draw the line from the origin to center.
scaleXThe scale value in x.
scaleYThe scale value in y.
void CC_DLL
cocos2d::DrawPrimitives::drawCircle
( const Vec2 center,
float  radius,
float  angle,
unsigned int  segments,
bool  drawLineToCenter 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
drawLineToCenterWhether or not draw the line from the origin to center.
var drawCircle ( var  center,
var  radius,
var  angle,
var  segments,
var  drawLineToCenter 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
drawLineToCenterWhether or not draw the line from the origin to center.
local drawCircle ( local  center,
local  radius,
local  angle,
local  segments,
local  drawLineToCenter 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
drawLineToCenterWhether or not draw the line from the origin to center.
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.

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
scaleXThe scale value in x.
scaleYThe scale value in y.
var drawSolidCircle ( var  center,
var  radius,
var  angle,
var  segments,
var  scaleX,
var  scaleY 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
scaleXThe scale value in x.
scaleYThe scale value in y.
local drawSolidCircle ( local  center,
local  radius,
local  angle,
local  segments,
local  scaleX,
local  scaleY 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
scaleXThe scale value in x.
scaleYThe scale value in y.
void CC_DLL
cocos2d::DrawPrimitives::drawSolidCircle
( const Vec2 center,
float  radius,
float  angle,
unsigned int  segments 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
var drawSolidCircle ( var  center,
var  radius,
var  angle,
var  segments 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
local drawSolidCircle ( local  center,
local  radius,
local  angle,
local  segments 
)

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

Parameters
centerThe circle center point.
radiusThe circle rotate of radius.
angleThe circle angel.
segmentsThe number of segments.
void CC_DLL
cocos2d::DrawPrimitives::drawQuadBezier
( const Vec2 origin,
const Vec2 control,
const Vec2 destination,
unsigned int  segments 
)

Draws a quad bezier path.

Parameters
originThe origin of the bezier path.
controlThe control of the bezier path.
destinationThe destination of the bezier path.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v0.8
var drawQuadBezier ( var  origin,
var  control,
var  destination,
var  segments 
)

Draws a quad bezier path.

Parameters
originThe origin of the bezier path.
controlThe control of the bezier path.
destinationThe destination of the bezier path.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v0.8
local drawQuadBezier ( local  origin,
local  control,
local  destination,
local  segments 
)

Draws a quad bezier path.

Parameters
originThe origin of the bezier path.
controlThe control of the bezier path.
destinationThe destination of the bezier path.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v0.8
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.

Parameters
originThe origin of the bezier path.
control1The first control of the bezier path.
control2The second control of the bezier path.
destinationThe destination of the bezier path.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v0.8
var drawCubicBezier ( var  origin,
var  control1,
var  control2,
var  destination,
var  segments 
)

Draws a cubic bezier path.

Parameters
originThe origin of the bezier path.
control1The first control of the bezier path.
control2The second control of the bezier path.
destinationThe destination of the bezier path.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v0.8
local drawCubicBezier ( local  origin,
local  control1,
local  control2,
local  destination,
local  segments 
)

Draws a cubic bezier path.

Parameters
originThe origin of the bezier path.
control1The first control of the bezier path.
control2The second control of the bezier path.
destinationThe destination of the bezier path.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v0.8
void CC_DLL
cocos2d::DrawPrimitives::drawCatmullRom
( PointArray *  arrayOfControlPoints,
unsigned int  segments 
)

Draws a Catmull Rom path.

Parameters
arrayOfControlPointsA point array of control point.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v2.0
var drawCatmullRom ( var  arrayOfControlPoints,
var  segments 
)

Draws a Catmull Rom path.

Parameters
arrayOfControlPointsA point array of control point.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v2.0
local drawCatmullRom ( local  arrayOfControlPoints,
local  segments 
)

Draws a Catmull Rom path.

Parameters
arrayOfControlPointsA point array of control point.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v2.0
void CC_DLL
cocos2d::DrawPrimitives::drawCardinalSpline
( PointArray *  config,
float  tension,
unsigned int  segments 
)

Draws a Cardinal Spline path.

Parameters
configA array point.
tensionThe tension of the spline.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v2.0
var drawCardinalSpline ( var  config,
var  tension,
var  segments 
)

Draws a Cardinal Spline path.

Parameters
configA array point.
tensionThe tension of the spline.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v2.0
local drawCardinalSpline ( local  config,
local  tension,
local  segments 
)

Draws a Cardinal Spline path.

Parameters
configA array point.
tensionThe tension of the spline.
segmentsThe The number of segments.
Warning
This function could be pretty slow. Use it only for debugging purposes.
Since
v2.0
void CC_DLL
cocos2d::DrawPrimitives::setDrawColor4B
( GLubyte  r,
GLubyte  g,
GLubyte  b,
GLubyte  a 
)

Set the drawing color with 4 unsigned bytes.

Parameters
rThe red color with a unsigned bytes.
gThe green color with a unsigned bytes.
bThe blue color with a unsigned bytes.
aAlpha with a unsigned bytes.
Since
v2.0
var setDrawColor4B ( var  r,
var  g,
var  b,
var  a 
)

Set the drawing color with 4 unsigned bytes.

Parameters
rThe red color with a unsigned bytes.
gThe green color with a unsigned bytes.
bThe blue color with a unsigned bytes.
aAlpha with a unsigned bytes.
Since
v2.0
local setDrawColor4B ( local  r,
local  g,
local  b,
local  a 
)

Set the drawing color with 4 unsigned bytes.

Parameters
rThe red color with a unsigned bytes.
gThe green color with a unsigned bytes.
bThe blue color with a unsigned bytes.
aAlpha with a 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.

Parameters
rThe red color with an floats.
gThe green color with an floats.
bThe blue color with an floats.
aAlpha with an floats.
Since
v2.0
var setDrawColor4F ( var  r,
var  g,
var  b,
var  a 
)

Set the drawing color with 4 floats.

Parameters
rThe red color with an floats.
gThe green color with an floats.
bThe blue color with an floats.
aAlpha with an floats.
Since
v2.0
local setDrawColor4F ( local  r,
local  g,
local  b,
local  a 
)

Set the drawing color with 4 floats.

Parameters
rThe red color with an floats.
gThe green color with an floats.
bThe blue color with an floats.
aAlpha with an floats.
Since
v2.0
void CC_DLL
cocos2d::DrawPrimitives::setPointSize
( GLfloat  pointSize)

Set the point size in points.

Default 1.

Parameters
pointSizeThe point size with an float.
Since
v2.0
var setPointSize ( var  pointSize)

Set the point size in points.

Default 1.

Parameters
pointSizeThe point size with an float.
Since
v2.0
local setPointSize ( local  pointSize)

Set the point size in points.

Default 1.

Parameters
pointSizeThe point size with an float.
Since
v2.0