Skip to content

Commit 771ac48

Browse files
author
SeanLin
committed
Merge pull request cocos2d#663 from ricardoquesada/spritebatch_create_init
SpriteBatch create calls init
2 parents 12ed43f + 5638698 commit 771ac48

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

cocos2d/sprite_nodes/CCSpriteBatchNode.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ cc.SpriteBatchNode = cc.Node.extend(/** @lends cc.SpriteBatchNode# */{
6969
ctor:function (fileImage) {
7070
this._super();
7171
if (fileImage) {
72-
this.initWithFile(fileImage, cc.DEFAULT_SPRITE_BATCH_CAPACITY);
72+
this.init(fileImage, cc.DEFAULT_SPRITE_BATCH_CAPACITY);
7373
}
7474
this._renderTexture = cc.RenderTexture.create(cc.canvas.width, cc.canvas.height);
7575
this.setContentSize(cc.size(cc.canvas.width, cc.canvas.height));
@@ -322,18 +322,13 @@ cc.SpriteBatchNode = cc.Node.extend(/** @lends cc.SpriteBatchNode# */{
322322
* @param {Number} capacity
323323
* @return {Boolean}
324324
*/
325-
initWithFile:function (fileImage, capacity) {
325+
init:function (fileImage, capacity) {
326326
var texture2D = cc.TextureCache.getInstance().textureForKey(fileImage);
327327
if (!texture2D)
328328
texture2D = cc.TextureCache.getInstance().addImage(fileImage);
329329
return this.initWithTexture(texture2D, capacity);
330330
},
331331

332-
init:function () {
333-
var texture = new cc.Texture2D();
334-
return this.initWithTexture(texture, 0);
335-
},
336-
337332
/**
338333
* increase Atlas Capacity
339334
*/
@@ -611,7 +606,7 @@ cc.SpriteBatchNode = cc.Node.extend(/** @lends cc.SpriteBatchNode# */{
611606

612607
/**
613608
* set the source blending function for the texture
614-
* @param {Number} src
609+
* @param {Number} src
615610
* @param {Number} dst
616611
*/
617612
setBlendFunc:function (src, dst) {
@@ -908,7 +903,7 @@ cc.SpriteBatchNode.create = function (fileImage, capacity) {
908903
}
909904

910905
var batchNode = new cc.SpriteBatchNode();
911-
batchNode.initWithFile(fileImage, capacity);
906+
batchNode.init(fileImage, capacity);
912907

913908
return batchNode;
914909
};

tests

Submodule tests updated 120 files

0 commit comments

Comments
 (0)