cocos2d-x  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCDrawingPrimitives.h File Reference

Drawing OpenGL ES primitives. More...

#include "ccTypes.h"
#include "ccMacros.h"
#include "cocoa/CCGeometry.h"

Namespaces

 cocos2d
 

Constant Groups

 cocos2d
 

Functions

void CC_DLL  ()
 Initializes the drawing primitives. More...
 
void CC_DLL  ()
 Frees allocated resources by the drawing primitives. More...
 
void CC_DLL  (const CCPoint &point)
 draws a point given x and y coordinate measured in points More...
 
void CC_DLL  (const CCPoint *points, unsigned int numberOfPoints)
 draws an array of points. More...
 
void CC_DLL  (const CCPoint &origin, const CCPoint &destination)
 draws a line given the origin and destination point measured in points More...
 
void CC_DLL  (CCPoint origin, CCPoint destination)
 draws a rectangle given the origin and destination point measured in points. More...
 
void CC_DLL  (CCPoint origin, CCPoint destination, ccColor4F color)
 draws a solid rectangle given the origin and destination point measured in points. More...
 
void CC_DLL  (const CCPoint *vertices, unsigned int numOfVertices, bool closePolygon)
 draws a polygon given a pointer to CCPoint coordinates and the number of vertices measured in points. More...
 
void CC_DLL  (const CCPoint *poli, unsigned int numberOfPoints, ccColor4F 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 CCPoint &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  (const CCPoint &center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
var  ( var center, var radius, var angle, var segments, var drawLineToCenter)
local  ( local center, local radius, local angle, local segments, local drawLineToCenter)
void CC_DLL  (const CCPoint &origin, const CCPoint &control, const CCPoint &destination, unsigned int segments)
 draws a quad bezier path More...
 
var  ( var origin, var control, var destination, var segments)
 draws a quad bezier path More...
 
local  ( local origin, local control, local destination, local segments)
 draws a quad bezier path More...
 
void CC_DLL  (const CCPoint &origin, const CCPoint &control1, const CCPoint &control2, const CCPoint &destination, unsigned int segments)
 draws a cubic bezier path More...
 
void CC_DLL  (CCPointArray *arrayOfControlPoints, unsigned int segments)
 draws a Catmull Rom path. More...
 
void CC_DLL  (CCPointArray *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...
 

Detailed Description

Drawing OpenGL ES primitives.

  • ccDrawPoint, ccDrawPoints
  • ccDrawLine
  • ccDrawRect, ccDrawSolidRect
  • ccDrawPoly, ccDrawSolidPoly
  • ccDrawCircle
  • ccDrawQuadBezier
  • ccDrawCubicBezier
  • ccDrawCatmullRom
  • ccDrawCardinalSpline

You can change the color, point size, width by calling:

  • ccDrawColor4B(), ccDrawColor4F()
  • ccPointSize()
  • glLineWidth()
Warning
These functions draws the Line, Point, Polygon, immediately. They aren't batched. If you are going to make a game that depends on these primitives, I suggest creating a batch. Instead you should use CCDrawNode