studio里使用合图感觉和spriteBatchNode差不多,但有不同,合图只起到在加载资源时减少IO的作用,起不到批渲染的作用。其实想想,studio本来就是用来拼UI界面的,一个上点规模的UI界面里都有N个层、layout、各种widget,树状关系,不在一个层里,是没办法批渲染的。
@H_301_11@ @H_301_11@ 1、把资源图片加到studio里,新建一个合图文件,然后把需要合并的小图拖到合图文件里。在studio项目里,被拖到合图文件里的小图的左上角会有个黄点。
1 var spriteFrameCache = cc.spriteFrameCache; 2 spriteFrameCache.addSpriteFrames(res.Plist_plist,res.Plist_png); 3 var fileName = "resources/common/head1.png"; 4 var sprite = new cc.Sprite(spriteFrameCache.getSpriteFrame(fileName)); 5 sprite.setPosition(100,300); 6 this.addChild(sprite);
转:http://www.cnblogs.com/zouzf/p/4524680.html