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

Drawing OpenGL ES primitives. More...

#include "base/ccTypes.h"
#include "base/ccMacros.h"
#include "math/CCMath.h"

Namespaces

 cocos2d
 
 cocos2d::DrawPrimitives
 

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...
 

Detailed Description

Drawing OpenGL ES primitives.

  • drawPoint, drawPoints
  • drawLine
  • drawRect, drawSolidRect
  • drawPoly, drawSolidPoly
  • drawCircle
  • drawQuadBezier
  • drawCubicBezier
  • drawCatmullRom
  • drawCardinalSpline

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

  • drawColor4B(), drawColor4F()
  • ccPointSize()
  • glLineWidth()
Warning
These functions draws the Line, Vec2, 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 DrawNode