cocos2d-之sprite类解析
来源:互联网 发布:淘宝怎么看同行点击率 编辑:程序博客网 时间:2024/04/29 19:26
/**
*精灵是一个2d图像
*
*精灵可以通过一张图片或者图片的某个矩形区域来创建
*
*为了优化图片,请遵循以下原则:
*-将所有精灵放在同一个spritesheet(精灵表单)
*-所有精灵里用同一个blending function(混合函数)
*-Renderer(渲染器)将会自动批处理精灵(会绘制在同一个OpenGL call里面)
*
*为了获得5%-10%的渲染效率提升,你可以把精灵继承自 SpriteBatchNode.同时遵循以下原则:
*-Alias/Antialias property属于SpriteBatchNode,不能独自设置aliased property
*-Blending function属于SpriteBatchNode,不能独自设置Blending *function
*-ParallaxNode(视差节点)不被支持,但是可以被"proxy" sprite(代理精灵)所模仿。
*-精灵只可以被其他精灵继承,或继承自其他精灵。
*
*精灵默认锚点是(0.5,0.5)
*/
*创建空的精灵,可以调用setTexture函数设置纹理
*/
static Sprite* create();
/**
*通过图片文件名字创建精灵
*精灵矩形的大小是图片的大小
*offset是(0,0)
*
* 图片路径举例:"scene1/monster.png".
*返回autoreleased sprite object
*/
static Sprite* create(const std::string& filename);
/**
*通过图片文件名字和指定矩形创建精灵
*/
static Sprite* create(const std::string& filename, const Rect& rect);
/**
*通过Texture2D object创建精灵
*
* After creation, the rect will be the size of the texture, and the offset will be (0,0).
*
* @param texture A pointer to a Texture2D object.
* @return An autoreleased sprite object.
*/
static Sprite* createWithTexture(Texture2D *texture);
/**
*通过纹理和矩形创建精灵
*texture A pointer to an existing Texture2D object
*rotated 矩形是否可以旋转
*/
static Sprite* createWithTexture(Texture2D *texture, const Rect& rect, bool rotated=false);
/**
通过精灵帧创建精灵
* @param spriteFrame A sprite frame which involves a texture and a rect.
*/
static Sprite* createWithSpriteFrame(SpriteFrame *spriteFrame);
/**
通过精灵帧名字创建精灵
*从SpriteFrameCache找出精灵帧
* If the SpriteFrame doesn't exist it will raise an exception.
*/
static Sprite* createWithSpriteFrameName(const std::string& spriteFrame);
*精灵是一个2d图像
*
*精灵可以通过一张图片或者图片的某个矩形区域来创建
*
*为了优化图片,请遵循以下原则:
*-将所有精灵放在同一个spritesheet(精灵表单)
*-所有精灵里用同一个blending function(混合函数)
*-Renderer(渲染器)将会自动批处理精灵(会绘制在同一个OpenGL call里面)
*
*为了获得5%-10%的渲染效率提升,你可以把精灵继承自 SpriteBatchNode.同时遵循以下原则:
*-Alias/Antialias property属于SpriteBatchNode,不能独自设置aliased property
*-Blending function属于SpriteBatchNode,不能独自设置Blending *function
*-ParallaxNode(视差节点)不被支持,但是可以被"proxy" sprite(代理精灵)所模仿。
*-精灵只可以被其他精灵继承,或继承自其他精灵。
*
*精灵默认锚点是(0.5,0.5)
*/
*创建空的精灵,可以调用setTexture函数设置纹理
*/
static Sprite* create();
/**
*通过图片文件名字创建精灵
*精灵矩形的大小是图片的大小
*offset是(0,0)
*
* 图片路径举例:"scene1/monster.png".
*返回autoreleased sprite object
*/
static Sprite* create(const std::string& filename);
/**
*通过图片文件名字和指定矩形创建精灵
*/
static Sprite* create(const std::string& filename, const Rect& rect);
/**
*通过Texture2D object创建精灵
*
* After creation, the rect will be the size of the texture, and the offset will be (0,0).
*
* @param texture A pointer to a Texture2D object.
* @return An autoreleased sprite object.
*/
static Sprite* createWithTexture(Texture2D *texture);
/**
*通过纹理和矩形创建精灵
*texture A pointer to an existing Texture2D object
*rotated 矩形是否可以旋转
*/
static Sprite* createWithTexture(Texture2D *texture, const Rect& rect, bool rotated=false);
/**
通过精灵帧创建精灵
* @param spriteFrame A sprite frame which involves a texture and a rect.
*/
static Sprite* createWithSpriteFrame(SpriteFrame *spriteFrame);
/**
通过精灵帧名字创建精灵
*从SpriteFrameCache找出精灵帧
* If the SpriteFrame doesn't exist it will raise an exception.
*/
static Sprite* createWithSpriteFrameName(const std::string& spriteFrame);
0 0
- cocos2d-之sprite类解析
- Cocos2d-JS Sprite精灵类
- cocos2d之精灵sprite的创建
- cocos2d-x 入门之Director,SceneLayer,Sprite
- cocos2d-x 之sprite布局日记
- Cocos2d-x之显示精灵Sprite
- Cocos2d-x 之显示精灵 Sprite
- 【Cocos2d-x】Sprite精灵类-创建Sprite精灵对象
- cocos2d-x 笔记(三) sprite类
- Cocos2d-JS中的Sprite精灵类
- Cocos2d-JS中创建Sprite精灵类
- Cocos2d-x Lua中Sprite精灵类
- Cocos2d学习之 How to add a sprite(1)
- Cocos2d-X游戏开发之Sprite纹理的大小限制
- cocos2d-html5学习之三-为sprite添加触摸事件
- cocos2d-html5学习之三-为sprite添加触摸事件
- cocos2d-x 之 CCPhysicsSprite 基于物理引擎的Sprite
- Cocos2d-x屏幕适配之Sprite绘制原理
- 自定义ButtonButton
- python 爬虫笔记--简单静态
- 第11周项目4-教师兼干部
- python 系统学习笔记(十二) -- ---os os.path os.walk
- 多级下拉列表选择处理
- cocos2d-之sprite类解析
- java的变量
- 让Xcode的控制台支持LLDB类型的打印
- 学着写LUA脚本(一)
- sql语法:inner join on, left join on, right join on详细使用方法
- Leetcode no. 208
- android 基础 加密 简易加密BASE64Decoder
- Android学习系列(29)--App调试的几个命令实践
- Tomcat的部署和路径的加载