cocos2.2.3中创建精灵对象的三大类方法
1.众生相,皆精灵
2.精灵的类继承关系
class CCSprite : public CCNode, public CCNodeRGBA, public CCTextureProtocol
3.创建精灵的三大类方法
4.代码实现
/**
* Creates an empty sprite without texture. You can call setTexture method subsequently.
*
* @return An empty sprite object that is marked as autoreleased.
*/
1.1 static CCSprite* create(); /**
* Creates a sprite with an image filename.
*
* After creation, the rect of sprite will be the size of the image,
* and the offset will be (0,0).
*
* @param pszFileName The string which indicates a path to image file, e.g., "scene1/monster.png".
* @return A valid sprite object that is marked as autoreleased.
*/
1.2 static CCSprite* create(const char *pszFileName); /**
* Creates a sprite with an image filename and a rect.
*
* @param pszFileName The string wich indicates a path to image file, e.g., "scene1/monster.png"
* @param rect Only the contents inside rect of pszFileName's texture will be applied for this sprite.
* @return A valid sprite object that is marked as autoreleased.
*/
1.3 static CCSprite* create(const char *pszFileName, const CCRect& rect); /**
* Creates a sprite with an exsiting texture contained in a CCTexture2D object
* After creation, the rect will be the size of the texture, and the offset will be (0,0).
*
* @param pTexture A pointer to a CCTexture2D object.
* @return A valid sprite object that is marked as autoreleased.
*/
2.1 static CCSprite* createWithTexture(CCTexture2D *pTexture); /**
* Creates a sprite with a texture and a rect.
*
* After creation, the offset will be (0,0).
*
* @param pTexture A pointer to an existing CCTexture2D object.
* You can use a CCTexture2D object for many sprites.
* @param rect Only the contents inside the rect of this texture will be applied for this sprite.
* @return A valid sprite object that is marked as autoreleased.
*/
2.2 static CCSprite* createWithTexture(CCTexture2D *pTexture, const CCRect& rect); /**
* Creates a sprite with an sprite frame.
*
* @param pSpriteFrame A sprite frame which involves a texture and a rect
* @return A valid sprite object that is marked as autoreleased.
*/
3.1 static CCSprite* createWithSpriteFrame(CCSpriteFrame *pSpriteFrame); /**
* Creates a sprite with an sprite frame name.
*
* A CCSpriteFrame will be fetched from the CCSpriteFrameCache by pszSpriteFrameName param.
* If the CCSpriteFrame doesn't exist it will raise an exception.
*
* @param pszSpriteFrameName A null terminated string which indicates the sprite frame name.
* @return A valid sprite object that is marked as autoreleased.
*/
3.2 static CCSprite* createWithSpriteFrameName(const char *pszSpriteFrameName);
cocos2.2.3中创建精灵对象的三大类方法的更多相关文章
- 通常Struts框架会自动地从action mapping中创建action对象
开发者不必在Spring中去注册action,尽管可以这么去做,通常Struts框架会自动地从action mapping中创建action对象 struts2-spring-plugin-x-x-x ...
- JavaScript中创建字典对象(dictionary)实例
这篇文章主要介绍了JavaScript中创建字典对象(dictionary)实例,本文直接给出了实现的源码,并给出了使用示例,需要的朋友可以参考下 对于JavaScript来说,其自身的Array对象 ...
- 简单使用JSON,JavaScript中创建 JSON 对象(一)
JSON:JavaScript 对象表示法(JavaScript Object Notation). JSON 是存储和交换文本信息的语法.类似 XML. JSON 比 XML 更小.更快,更易解析. ...
- SpriteBuilder中CCB精灵对象的Sprite frame为什么有时候不能修改
有时候你会发现CCB中的精灵对象(root节点)的Sprite frame是灰色的,不能修改.因为它是根对象,所以不存在被嵌入其他CCB的情况,那到底是什么原因呢? 可以发现此时的Timeline当前 ...
- Java中创建实例化对象的几种方式
Java中创建实例化对象有哪些方式? ①最常见的创建对象方法,使用new语句创建一个对象.②通过工厂方法返回对象,例:String s =String.valueOf().(工厂方法涉及到框架)③动用 ...
- Java中创建的对象多了,必然影响内存和性能
1, Java中创建的对象多了,必然影响内存和性能,所以对象的创建越少越好,最后还要记得销毁.
- spring中创建bean对象的三种方式以及作用范围
时间:2020/02/02 一.在spring的xml配置文件中创建bean对象的三种方式: 1.使用默认构造函数创建.在spring的配置文件中使用bean标签,配以id和class属性之后,且没有 ...
- 本地C代码中创建Java对象
作者:唐老师,华清远见嵌入式学院讲师. 创建Java域的对象就是创建Java类的实例,再调用Java类的构造方法. 以Bitmap的构建为例,Bitmap中并没有Java对象创建的代码及外部能访问的构 ...
- R中创建not-yet-evaluated对象
create not-yet-evaluated object在R中创建 not-yet-evaluated(就是some code we will evaluated later!!)对象;然后执行 ...
随机推荐
- UIActivityIndicatorView的使用方法(旋转动画)
- (void)viewDidLoad { [super viewDidLoad]; //创建UIActivityIndicatorView并设置样式:WhiteLarge为37 * 37,Gray和 ...
- Linux之查看文件大小
1.查看当前文件大小du -sh ./ du [-abcDhHklmsSx] [-L <符号连接>][-X <文件>][--block-size][--exclude=< ...
- 四舍五入PK银行四舍五入
描述 在实际开发中decimal.Round(1.23525,4)!=1.2353实际是1.2352,而decimal.Round(1.23535,4)==1.2354 说明 四舍五入:当舍去位的数值 ...
- U3D 飞机大战(MVC模式)解析--面向对象编程思想
在自己研究U3D游戏的时候,看过一些人的简单的游戏开发视频,写的不错,只是个人是java web 开发的人,所以结合着MVC思想,对游戏开发进行了一番考虑. 如果能把游戏更加的思想化,分工化,开发便明 ...
- Android 联系人字母排序(仿微信)
现在很多APP只要涉及到联系人的界面,几乎都会采取字母排序以及导航的方式.作为程序猿,这种已经普及的需求还是需要学习的,于是小生开始了在网上默默的学习之路,网上学习的资料质量参差不齐,不过也有很不错的 ...
- 说一说Android的工程目录结构
这段时间正在学习有关Android的知识,对在Eclipse下开发的Android项目的目录结构有了一定的了解,在此对目录结构做一个简单的介绍.下图是在Eclipse下Android项目展开的项目目录 ...
- ASP.NET,web.config 中SessionState的配置
web Form 网页是基于HTTP的,它们没有状态, 这意味着它们不知道所有的请求是否来自同一台客户端计算机,网页是受到了破坏,以及是否得到了刷新,这样就可能造成信息的丢失. 于是, 状态管理就成了 ...
- ubuntu启动失败the system is running in low graphics mode
ubuntu启动失败the system is running in lowg raphics mode 起因 ubuntu重新设置selinux的模式 修改配置文件/etc/selinux/conf ...
- 服务器无法播放flv格式的视频解决办法
浏览某个网站时播放视频可能会出现下面的情况: 其实原因很简单,因为国内大多都是Win2003的主机 .默认是没有指定输出FLV这种格式的. 虽然FTP里面可以看见,但无法通过http访问,也就无法播放 ...
- 【leetcode】15. 3Sum
题目描述: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find ...