CCSpriteBatchNode读取plist
2014-04-30 14:56
441 查看
//首先将plist读到缓存中
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("popstar.plist", "popstar.png");
//将资源添加到CCSpriteBatchNode里。
CCSpriteBatchNode *aParent = CCSpriteBatchNode::create("popstar.png");
addChild(aParent);
//创建精灵并添加到CCSpriteBatchNode里,1000.png是popstar.plist的一个资源
CCSprite *pFather = CCSprite::createWithSpriteFrameName("1000.png");
pFather->setPosition(ccp(200,200));
aParent->addChild(pFather);
如此一来,不管需要显示多少个精灵,相同的精灵只会添加一个。
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("popstar.plist", "popstar.png");
//将资源添加到CCSpriteBatchNode里。
CCSpriteBatchNode *aParent = CCSpriteBatchNode::create("popstar.png");
addChild(aParent);
//创建精灵并添加到CCSpriteBatchNode里,1000.png是popstar.plist的一个资源
CCSprite *pFather = CCSprite::createWithSpriteFrameName("1000.png");
pFather->setPosition(ccp(200,200));
aParent->addChild(pFather);
如此一来,不管需要显示多少个精灵,相同的精灵只会添加一个。
相关文章推荐
- 为什么我要用 Node.js? 案例逐一介绍
- node.js 创建第一个web应用
- win7 64 安装nodejs canvas
- (译)Node.js的模块-exports和module.exports
- 使用forever运行nodejs应用
- Node JS 快速制作图片缩略图
- 跨平台的.NET集成开发环境:MonoDevelop
- Nodejs 使用supervison 提高开发效率
- Node.js
- Hadoop single Node cluster
- 【leetcode】Populating Next Right Pointers in Each Node
- struct BsTreeNode
- LeetCode刷题笔录 Populating Next Right Pointers in Each Node
- Win7 之 NodeJS 安装
- 使用PDFKit和Node.js生成服务器端PDF文件
- nodejs request模块gzip response的解压问题
- 在AODV中添加恶意节点:NS2: Adding Malicious Node to AODV修改版
- inode-软链接与硬链接
- Node.js学习笔记(3) - 简单的curd
- 重启或动态加入datanode节点