cocos2d-x 3.0
- 首页 - 相关页面 - 模块 - 命名空间 - - 文件 -
命名空间 - 图1 命名空间 - 图2)
- 文件列表 - 文件成员

全部)) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义)))

命名空间 | 函数

CCDrawingPrimitives.h 文件参考

绘制OpenGL ES原语。 更多…

#include "base/ccTypes.h"

#include "base/ccMacros.h"

#include "math/CCMath.h"

## 命名空间
cocos2d
Add deprecated global functions and variables here.
cocos2d::DrawPrimitives
## 函数
void init ()
初始化绘图原语 更多…
void free ()
释放绘制原语时所分配的资源 更多…
void drawPoint (const Vec2 &point)
给定x、y值绘制一个点。其中x、y使用像素来度量 更多…
void drawPoints (const Vec2 points, unsigned int numberOfPoints)
绘制一组点s. 更多…
void drawLine (const Vec2 &origin, const Vec2 &destination)
给定起始点与终止点绘制一条线,其中起始点与终止点坐标使用像素来度量 更多…
void drawRect (Vec2 origin, Vec2 destination)
给定起始点与终止点绘制一个矩形,其中起始点与终止点坐标使用像素来度量 更多…
void drawSolidRect (Vec2 origin, Vec2 destination, Color4F color)
给定起始点与终止点绘制一个实体矩形,其中起始点与终止点坐标使用像素来度量。 更多…
void drawPoly (const Vec2 vertices, unsigned int numOfVertices, bool closePolygon)
给定一个指向点坐标的指针以及顶点数目绘制一个多边形。其中每个点的坐标使用像素来度量。 这个多边形可以是封闭的也可以是打开的。 更多…
void drawSolidPoly (const Vec2 poli, unsigned int numberOfPoints, Color4F color)
给定一个指向点坐标的指针以及顶点数目以及颜色绘制一个实体多边形。其中每个点的坐标使用像素来度量。 更多…
void drawCircle (const Vec2 &center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY)
给定中心点、半径、分段数来绘制一个圆。 更多…
void drawCircle (const Vec2 &center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
void drawSolidCircle (const Vec2 &center, float radius, float angle, unsigned int segments, float scaleX, float scaleY)
给定中心点、半径、分段数来绘制一个实体圆。 更多…
void drawSolidCircle (const Vec2 &center, float radius, float angle, unsigned int segments)
void drawQuadBezier (const Vec2 &origin, const Vec2 &control, const Vec2 &destination, unsigned int segments)
绘制一个quad贝塞尔曲线 更多…
void drawCubicBezier (const Vec2 &origin, const Vec2 &control1, const Vec2 &control2, const Vec2 &destination, unsigned int segments)
绘制一个cubic贝塞尔曲线 更多…
void drawCatmullRom (PointArray arrayOfControlPoints, unsigned int segments)
绘制一个Catmull-Rom样条曲线. 更多…
void drawCardinalSpline (PointArray *config, float tension, unsigned int segments)
绘制一个Cardinal样条曲线. 更多…
void setDrawColor4B (GLubyte r, GLubyte g, GLubyte b, GLubyte a)
用4个无符号比特值来设置绘图颜色 更多…
void setDrawColor4F (GLfloat r, GLfloat g, GLfloat b, GLfloat a)
用4个浮点值来设置绘图颜色 更多…
void setPointSize (GLfloat pointSize)
设置点的像素大小。默认为 1。 更多…

详细描述

绘制OpenGL ES原语。

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

你可以通过以下函数来改变颜色点的大小:

@警告 这些函数在绘制线、Vec2、多边形的时候是立即执行的。他们并不是批处理的。如果你要用这些原语函数来做游戏,我建议你建立一个批处理来完成。你应该使用DrawNode来代替。