cocos2d-x节点(CCDrawingPrimitives.h)API
来源:互联网 发布:android编程入门自学 编辑:程序博客网 时间:2024/05/16 18:02
本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
cocos2d-x节点(CCDrawingPrimitives.h)API
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记
绘制基本图元(矩形,多边形,点线)
///cocos2d-x-3.0alpha0/cocos2dx/draw_nodes//绘制基本图元(矩形,多边形,点线)/* * * IMPORTANT IMPORTANT IMPORTANT IMPORTANT * * * LEGACY functions //传统功能 * * USE DrawNode Instead //使用DrawNode 代替 * */#ifndef __CCDRAWING_PRIMITIVES__#define __CCDRAWING_PRIMITIVES__#include "ccTypes.h"#include "ccMacros.h"#include "cocoa/CCGeometry.h" // for Point/** @file 绘制 OpenGL ES 图元. - drawPoint, drawPoints - drawLine - drawRect, drawSolidRect //绘制实心矩形 - drawPoly, drawSolidPoly - drawCircle - drawQuadBezier //四次方贝塞尔 - drawCubicBezier //三次方贝塞尔 - drawCatmullRom - drawCardinalSpline 你可以使用下面的来改变 color, point size, width : - drawColor4B(), drawColor4F() - ccPointSize() - glLineWidth() @warning 这些功能会立即绘制 Line, Point, Polygon(多边形). 他们不是批处理。如果你打算做一个基于这些图元的游戏,建议创建一个批处理.代替你使用 DrawNode */NS_CC_BEGIN/** * @addtogroup global * @{ */class PointArray;namespace DrawPrimitives{ /** 初始化 drawing primitives(图元) */ void init(); /**释放绘制图元时分配的资源*/ void free(); /** 使用给定的 x、y坐标(points)绘制一个点 */ void drawPoint( const Point& point ); /** draws an array of points. @since v0.7.2 */ void drawPoints( const Point *points, unsigned int numberOfPoints ); /** 使用给定的 origin(起始点)、destinnation point(回归点)绘制一条线 */ void drawLine( const Point& origin, const Point& destination ); /** 使用给定的 origin(起始点)、destinnation point(回归点)绘制一个矩形 .. */ void drawRect( Point origin, Point destination ); /** 使用给定的 origin(起始点)、destinnation point(回归点)绘制一个实心矩形 . @since 1.1 */ void drawSolidRect( Point origin, Point destination, Color4F color ); /** 使用 给定的点坐标,顶点数(points) 绘制一个实心多变形. 这个多边形可以打开或关闭 */ void drawPoly( const Point *vertices, unsigned int numOfVertices, bool closePolygon ); /** 使用 给定的CGpoint 点坐标,顶点数(points)、color 绘制一个实心多变形 */ void drawSolidPoly( const Point *poli, unsigned int numberOfPoints, Color4F color ); /** 使用给定的 center, radius and number of segments(段数)绘制一个圆. */ void drawCircle( const Point& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY); void drawCircle( const Point& center, float radius, float angle, unsigned int segments, bool drawLineToCenter); /** 使用给定的 center, radius and number of segments(段数)绘制一个实心圆. */ void drawSolidCircle( const Point& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY); void drawSolidCircle( const Point& center, float radius, float angle, unsigned int segments); /** draws a quad bezier path //四次方贝塞尔 @warning 这个功能可能非常缓慢,使用它仅仅是为了方便调试. @since v0.8 */ void drawQuadBezier(const Point& origin, const Point& control, const Point& destination, unsigned int segments); /** draws a cubic bezier path // //三次方贝塞尔 @warning 这个功能可能非常缓慢,使用它仅仅是为了方便调试. @since v0.8 */ void drawCubicBezier(const Point& origin, const Point& control1, const Point& control2, const Point& destination, unsigned int segments); /** draws a Catmull Rom path. @warning 这个功能可能非常缓慢,使用它仅仅是为了方便调试. @since v2.0 */ void drawCatmullRom( PointArray *arrayOfControlPoints, unsigned int segments ); /** 绘制 Cardinal Spline 路径. //基数样条 @warning 这个功能可能非常缓慢,使用它仅仅是为了方便调试. @since v2.0 */ void drawCardinalSpline( PointArray *config, float tension, unsigned int segments ); /** 使用 4 个 unsigned(无符号) bytes(字节) 设置绘制颜色 @since v2.0 */ void setDrawColor4B( GLubyte r, GLubyte g, GLubyte b, GLubyte a ); /** 使用 4 个 floats 设置绘制颜色 @since v2.0 */ void setDrawColor4F( GLfloat r, GLfloat g, GLfloat b, GLfloat a ); /** set 点的尺寸(以点为单位). Default 1. @since v2.0 */ void setPointSize( GLfloat pointSize ); };// end of global group/// @}NS_CC_END#endif // __CCDRAWING_PRIMITIVES__
- cocos2d-x节点(CCDrawingPrimitives.h)API
- cocos2d-x节点(cocos2d.h)API
- cocos2d-X 节点(CCNode.h)API
- cocos2d-X 节点(CCLayer.h)API
- cocos2d-X 节点(CCMenu.h)API
- cocos2d-X 节点(CCMenuItem.h)API
- cocos2d-X 节点(CCSprite.h)API
- cocos2d-X 节点(CCTexture2D.h)API
- cocos2d-X 节点(SpriteBatchNode.h.)API
- cocos2d-X 节点(CCSpriteFrame.h..)API
- cocos2d-X 节点(CCAnimationCache.h)API
- cocos2d-X 节点(CCCamera.h.)API
- cocos2d-X 节点(CCAction.h)API
- cocos2d-X 节点(CCActionManager.h)API
- cocos2d-X 节点(CCIMEDelegate.h)API
- cocos2d-X 节点(CCLabelAtlas.h)API
- cocos2d-X 节点(CCLabelBMFont.h)API
- cocos2d-X 节点(CCLabelTTF.h)API
- 轻量级组件与重量级组件的区别
- 大数据时代下的智慧农业
- cocos2d-x节点(CCString.h)API
- cmd
- cocos2d-x节点(CCDrawNode.h)API
- cocos2d-x节点(CCDrawingPrimitives.h)API
- cocos2d-x节点(CCGrid.h)API
- cocos2d-x节点(CCGrabber.h)API
- input type详解
- cocos2d-x节点(ccConfig.h)API
- cocos2d-x节点(CCEventType.h)API
- cocos2d-x节点(ccMacros.h)API
- cocos2d-x节点(CCProtocols.h)API
- 常见的内存使用不当的情况