当前位置:Gxlcms > mysql > Cocos2d-x常用绘制函数

Cocos2d-x常用绘制函数

时间:2021-07-01 10:21:17 帮助过:28人阅读

1、常用绘制图形函数如下。 1 ccDrawColor4B(GLubyte r,GLubyte g,GLubyte b,GLubyte a) 作用: 设置绘制颜色。 参数1: 红色分量。 参数2: 绿色分量。 参数3: 蓝色分量。 参数4: 透明度。 2 glLineWidth(GLfloat width) 作用: 设置线条宽度。 参数: 宽

1、常用绘制图形函数如下。

<1> ccDrawColor4B(GLubyte r,GLubyte g,GLubyte b,GLubyte a)

作用: 设置绘制颜色。

参数1: 红色分量。

参数2: 绿色分量。

参数3: 蓝色分量。

参数4: 透明度。

<2> glLineWidth(GLfloat width)

作用: 设置线条宽度。

参数: 宽度值。

<3> ccDrawLine(const CCPoint& origin,const CCPoint& destination)

作用: 绘制一条直线。

参数1: 起始坐标。

参数2: 终点坐标。

<4> ccPointSize(GLfloat pointSize)

作用: 设置每个点的大小。

参数: 点的大小。

<5> ccDrawPoint(const CCPoint& point)

作用: 绘制一个点。

参数: 点的坐标。

<6> ccDrawCircle(const CCPoint& center,float radius,float angle,unsigned int segments,bool drawLineToCenter)

作用: 绘制圆形。

参数1 :中心点坐标。

参数2: 半径长度。

参数3: 圆形的角度。

参数4: 角度。

参数5: 定点数。

<7> ccDrawPoly(const CCPoint * poli,unsigned int numberOfPoints,bool closePolygon)

作用: 绘制空心多边形。

参数1: 顶点数组。

参数2: 点数量。

参数3: 是否自动封闭多边形。

<8> ccDrawSolidRect(CCPoint origin,CCPoint destination,ccColor4F color)

作用: 绘制填充的矩形。

参数1: 顶点数组。

参数2: 点数量。

参数3: 矩形的颜色。

<9> ccDrawRect(CCPoint origin,CCPoint destination)

作用: 绘制空心的矩形。

参数1: 顶点数组。

参数2: 点数量。

<10> ccDrawQuadBezier(const CCPoint& origin,const CCPoint& control,const CCPoint& destination,unsigned int segments)

作用: 绘制贝塞尔曲线。

参数1: 起始点。

参数2: 控制点。

参数3: 结束点。

参数4: 顶点数。

<11> ccDrawCubicBezier(conts CCPoint& origin,const CCPoint& control1,const CCPoint& control2,const CCPoint& destination,unsigned int segments)

作用: 绘制立体贝塞尔曲线。

参数1: 起始点。

参数2: 控制点1。

参数3: 控制点2.

参数4: 结束点。

参数5: 顶点数。

人气教程排行