diff --git a/cocos2d/ToMerge/wrappers/progress-timer.js b/cocos2d/ToMerge/wrappers/progress-timer.js index 76ac5683fa..328c05c2b2 100644 --- a/cocos2d/ToMerge/wrappers/progress-timer.js +++ b/cocos2d/ToMerge/wrappers/progress-timer.js @@ -133,7 +133,7 @@ var ProgressTimerWrapper = cc.Class({ }, createNode: function (node) { - node = node || new cc.ProgressTimer(new cc.Sprite()); + node = node || new cc.ProgressTimer(new _ccsg.Sprite()); var sp = node.getSprite(); if (this._texture) { diff --git a/cocos2d/actions/CCAction.js b/cocos2d/actions/CCAction.js index 8d4e615e0a..a1de81b5f4 100644 --- a/cocos2d/actions/CCAction.js +++ b/cocos2d/actions/CCAction.js @@ -478,12 +478,12 @@ cc.Speed.create = cc.speed; * @param {cc.Rect} rect * @example * // creates the action with a set boundary - * var sprite = new cc.Sprite("spriteFileName"); + * var sprite = new _ccsg.Sprite("spriteFileName"); * var followAction = new cc.Follow(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height)); * this.runAction(followAction); * * // creates the action with no boundary set - * var sprite = new cc.Sprite("spriteFileName"); + * var sprite = new _ccsg.Sprite("spriteFileName"); * var followAction = new cc.Follow(sprite); * this.runAction(followAction); * @@ -668,12 +668,12 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ * @example * // example * // creates the action with a set boundary - * var sprite = new cc.Sprite("spriteFileName"); + * var sprite = new _ccsg.Sprite("spriteFileName"); * var followAction = cc.follow(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height)); * this.runAction(followAction); * * // creates the action with no boundary set - * var sprite = new cc.Sprite("spriteFileName"); + * var sprite = new _ccsg.Sprite("spriteFileName"); * var followAction = cc.follow(sprite); * this.runAction(followAction); */ diff --git a/cocos2d/actions/CCActionInterval.js b/cocos2d/actions/CCActionInterval.js index 63bef576b6..420c89fad6 100644 --- a/cocos2d/actions/CCActionInterval.js +++ b/cocos2d/actions/CCActionInterval.js @@ -3347,7 +3347,7 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ /** * Start the action with target. - * @param {cc.Sprite} target + * @param {_ccsg.Sprite} target */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); diff --git a/cocos2d/core/base-nodes/CCSGNode.js b/cocos2d/core/base-nodes/CCSGNode.js index e63715894f..8eddccf415 100644 --- a/cocos2d/core/base-nodes/CCSGNode.js +++ b/cocos2d/core/base-nodes/CCSGNode.js @@ -38,7 +38,7 @@ cc.s_globalOrderOfArrival = 1; /** *

ccsg.Node is the root class of all node. Anything that gets drawn or contains things that get drawn is a ccsg.Node.
- * The most popular ccsg.Nodes are: ccsg.Scene, cc.Layer, cc.Sprite, cc.Menu.

+ * The most popular ccsg.Nodes are: ccsg.Scene, cc.Layer, _ccsg.Sprite, cc.Menu.

* *

The main features of a ccsg.Node are:
* - They can contain other ccsg.Node nodes (addChild, getChildByTag, removeChild, etc)
@@ -1713,8 +1713,8 @@ _ccsg.Node = cc.Class({ * this.addChild(batch); * * // create two sprites, spriteA will be added to batchNode, they are using different textures. - * var spriteA = new cc.Sprite(batch->getTexture()); - * var spriteB = new cc.Sprite("Icon-72.png"); + * var spriteA = new _ccsg.Sprite(batch->getTexture()); + * var spriteB = new _ccsg.Sprite("Icon-72.png"); * * batch.addChild(spriteA); * diff --git a/cocos2d/core/labelttf/CCLabelTTF.js b/cocos2d/core/labelttf/CCLabelTTF.js index 3d475c5fc6..c7b406d5f3 100644 --- a/cocos2d/core/labelttf/CCLabelTTF.js +++ b/cocos2d/core/labelttf/CCLabelTTF.js @@ -26,12 +26,12 @@ /** *

cc.LabelTTF is a subclass of cc.TextureNode that knows how to render text labels with system font or a ttf font file
- * All features from cc.Sprite are valid in cc.LabelTTF
+ * All features from _ccsg.Sprite are valid in cc.LabelTTF
* cc.LabelTTF objects are slow for js-binding on mobile devices.
* Consider using cc.LabelAtlas or cc.LabelBMFont instead.
* You can create a cc.LabelTTF from a font name, alignment, dimension and font size or a cc.FontDefinition object.

* @class - * @extends cc.Sprite + * @extends _ccsg.Sprite * * @param {String} text * @param {String|cc.FontDefinition} [fontName="Arial"] @@ -63,7 +63,7 @@ * @property {Number} shadowOpacity - The opacity of shadow * @property {Number} shadowBlur - The blur size of shadow */ -cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{ +cc.LabelTTF = _ccsg.Sprite.extend(/** @lends cc.LabelTTF# */{ _dimensions: null, _hAlignment: cc.TextAlignment.CENTER, _vAlignment: cc.VerticalTextAlignment.TOP, @@ -144,7 +144,7 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{ }, ctor: function (text, fontName, fontSize, dimensions, hAlignment, vAlignment) { - cc.Sprite.prototype.ctor.call(this); + _ccsg.Sprite.prototype.ctor.call(this); this._dimensions = cc.size(0, 0); this._hAlignment = cc.TextAlignment.LEFT; @@ -720,23 +720,23 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{ getContentSize: function () { if (this._needUpdateTexture) this._renderCmd._updateTTF(); - return cc.Sprite.prototype.getContentSize.call(this); + return _ccsg.Sprite.prototype.getContentSize.call(this); }, _getWidth: function () { if (this._needUpdateTexture) this._renderCmd._updateTTF(); - return cc.Sprite.prototype._getWidth.call(this); + return _ccsg.Sprite.prototype._getWidth.call(this); }, _getHeight: function () { if (this._needUpdateTexture) this._renderCmd._updateTTF(); - return cc.Sprite.prototype._getHeight.call(this); + return _ccsg.Sprite.prototype._getHeight.call(this); }, setTextureRect: function (rect, rotated, untrimmedSize) { //set needConvert to false - cc.Sprite.prototype.setTextureRect.call(this, rect, rotated, untrimmedSize, false); + _ccsg.Sprite.prototype.setTextureRect.call(this, rect, rotated, untrimmedSize, false); }, /** diff --git a/cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js b/cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js index 21195ed493..7d86cebe2d 100644 --- a/cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js +++ b/cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js @@ -443,22 +443,22 @@ cc.LabelTTF._firsrEnglish = /^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôû]/; (function(){ cc.LabelTTF.CacheCanvasRenderCmd = function (renderable) { - cc.Sprite.CanvasRenderCmd.call(this, renderable); + _ccsg.Sprite.CanvasRenderCmd.call(this, renderable); cc.LabelTTF.CacheRenderCmd.call(this); }; - var proto = cc.LabelTTF.CacheCanvasRenderCmd.prototype = Object.create(cc.Sprite.CanvasRenderCmd.prototype); + var proto = cc.LabelTTF.CacheCanvasRenderCmd.prototype = Object.create(_ccsg.Sprite.CanvasRenderCmd.prototype); cc.js.mixin(proto, cc.LabelTTF.CacheRenderCmd.prototype); proto.constructor = cc.LabelTTF.CacheCanvasRenderCmd; })(); (function(){ cc.LabelTTF.CanvasRenderCmd = function (renderable) { - cc.Sprite.CanvasRenderCmd.call(this, renderable); + _ccsg.Sprite.CanvasRenderCmd.call(this, renderable); cc.LabelTTF.RenderCmd.call(this); }; - cc.LabelTTF.CanvasRenderCmd.prototype = Object.create(cc.Sprite.CanvasRenderCmd.prototype); + cc.LabelTTF.CanvasRenderCmd.prototype = Object.create(_ccsg.Sprite.CanvasRenderCmd.prototype); cc.js.mixin(cc.LabelTTF.CanvasRenderCmd.prototype, cc.LabelTTF.RenderCmd.prototype); var proto = cc.LabelTTF.CanvasRenderCmd.prototype; diff --git a/cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js b/cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js index d813b6c728..1601c2b9d8 100644 --- a/cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js +++ b/cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js @@ -25,15 +25,15 @@ // ----------------------------------- LabelTTF WebGL render cmd ---------------------------- (function() { cc.LabelTTF.WebGLRenderCmd = function (renderable) { - cc.Sprite.WebGLRenderCmd.call(this, renderable); + _ccsg.Sprite.WebGLRenderCmd.call(this, renderable); cc.LabelTTF.CacheRenderCmd.call(this); this.setShaderProgram(cc.shaderCache.programForKey(cc.LabelTTF._SHADER_PROGRAM)); }; - var proto = cc.LabelTTF.WebGLRenderCmd.prototype = Object.create(cc.Sprite.WebGLRenderCmd.prototype); + var proto = cc.LabelTTF.WebGLRenderCmd.prototype = Object.create(_ccsg.Sprite.WebGLRenderCmd.prototype); cc.js.mixin(proto, cc.LabelTTF.CacheRenderCmd.prototype); proto.constructor = cc.LabelTTF.WebGLRenderCmd; proto._updateColor = function () { this._updateTexture(); - cc.Sprite.WebGLRenderCmd.prototype._updateColor.call(this); + _ccsg.Sprite.WebGLRenderCmd.prototype._updateColor.call(this); } })(); \ No newline at end of file diff --git a/cocos2d/core/platform/CCConfig.js b/cocos2d/core/platform/CCConfig.js index 1f8bef6f72..e06a5f4fad 100644 --- a/cocos2d/core/platform/CCConfig.js +++ b/cocos2d/core/platform/CCConfig.js @@ -45,7 +45,7 @@ window["CocosEngine"] = cc.ENGINE_VERSION = "Cocos2d-JS v3.9 Beta"; * The "correct" way to prevent artifacts is by using the spritesheet-artifact-fixer.py or a similar tool.
*
* Affected nodes:
- * - cc.Sprite / cc.SpriteBatchNode and subclasses: cc.LabelBMFont, cc.TMXTiledMap
+ * - _ccsg.Sprite / cc.SpriteBatchNode and subclasses: cc.LabelBMFont, cc.TMXTiledMap
* - cc.LabelAtlas
* - cc.QuadParticleSystem
* - cc.TileMap
@@ -82,7 +82,7 @@ cc.DIRECTOR_FPS_INTERVAL = 0.5; /** *

- * If enabled, the ccsg.Node objects (cc.Sprite, _ccsg.Label,etc) will be able to render in subpixels.
+ * If enabled, the ccsg.Node objects (_ccsg.Sprite, _ccsg.Label,etc) will be able to render in subpixels.
* If disabled, integer pixels will be used.
*
* To enable set it to 1. Enabled by default.
@@ -95,7 +95,7 @@ cc.COCOSNODE_RENDER_SUBPIXEL = 1; /** *

- * If enabled, the cc.Sprite objects rendered with cc.SpriteBatchNode will be able to render in subpixels.
+ * If enabled, the _ccsg.Sprite objects rendered with cc.SpriteBatchNode will be able to render in subpixels.
* If disabled, integer pixels will be used.
*
* To enable set it to 1. Enabled by default.
@@ -220,7 +220,7 @@ cc.USE_LA88_LABELS = 1; /** *

- * If enabled, all subclasses of cc.Sprite will draw a bounding box
+ * If enabled, all subclasses of _ccsg.Sprite will draw a bounding box
* Useful for debugging purposes only. It is recommend to leave it disabled.
*
* To enable set it to a value different than 0. Disabled by default:
@@ -235,7 +235,7 @@ cc.SPRITE_DEBUG_DRAW = 0; /** *

- * If enabled, all subclasses of cc.Sprite that are rendered using an cc.SpriteBatchNode draw a bounding box.
+ * If enabled, all subclasses of _ccsg.Sprite that are rendered using an cc.SpriteBatchNode draw a bounding box.
* Useful for debugging purposes only. It is recommend to leave it disabled.
*
* To enable set it to a value different than 0. Disabled by default. diff --git a/cocos2d/core/scenes/CCLoaderScene.js b/cocos2d/core/scenes/CCLoaderScene.js index debc26f5dc..41b205ba27 100644 --- a/cocos2d/core/scenes/CCLoaderScene.js +++ b/cocos2d/core/scenes/CCLoaderScene.js @@ -77,7 +77,7 @@ cc.LoaderScene = _ccsg.Scene.extend({ var texture2d = self._texture2d = new cc.Texture2D(); texture2d.initWithElement(img); texture2d.handleLoadedTexture(); - var logo = self._logo = new cc.Sprite(texture2d); + var logo = self._logo = new _ccsg.Sprite(texture2d); logo.setScale(cc.contentScaleFactor()); logo.x = centerPos.x; logo.y = centerPos.y; diff --git a/cocos2d/core/sprites/CCAnimation.js b/cocos2d/core/sprites/CCAnimation.js index 63f058aa1c..21466fbaf1 100644 --- a/cocos2d/core/sprites/CCAnimation.js +++ b/cocos2d/core/sprites/CCAnimation.js @@ -155,7 +155,7 @@ cc.AnimationFrame.create = function(spriteFrame,delayUnits,userInfo){ /** *

- * A cc.SpriteFrameAnimation object is used to perform animations on the cc.Sprite objects.
+ * A cc.SpriteFrameAnimation object is used to perform animations on the _ccsg.Sprite objects.
*
* The cc.SpriteFrameAnimation object contains cc.SpriteFrame objects, and a possible delay between the frames.
* You can animate a cc.SpriteFrameAnimation object by using the cc.Animate action. diff --git a/cocos2d/core/sprites/CCBakeSprite.js b/cocos2d/core/sprites/CCBakeSprite.js index f24bc05121..a394a38119 100644 --- a/cocos2d/core/sprites/CCBakeSprite.js +++ b/cocos2d/core/sprites/CCBakeSprite.js @@ -25,14 +25,14 @@ /** * cc.BakeSprite is a type of sprite that will be cached. * @class - * @extends cc.Sprite + * @extends _ccsg.Sprite */ -cc.BakeSprite = cc.Sprite.extend(/** @lends cc.BakeSprite# */{ +cc.BakeSprite = _ccsg.Sprite.extend(/** @lends cc.BakeSprite# */{ _cacheCanvas: null, _cacheContext: null, ctor: function(){ - cc.Sprite.prototype.ctor.call(this); + _ccsg.Sprite.prototype.ctor.call(this); var canvasElement = document.createElement("canvas"); canvasElement.width = canvasElement.height = 10; this._cacheCanvas = canvasElement; diff --git a/cocos2d/core/sprites/CCSprite.js b/cocos2d/core/sprites/CCSGSprite.js similarity index 95% rename from cocos2d/core/sprites/CCSprite.js rename to cocos2d/core/sprites/CCSGSprite.js index 849eea948b..68fb8f5427 100644 --- a/cocos2d/core/sprites/CCSprite.js +++ b/cocos2d/core/sprites/CCSGSprite.js @@ -27,9 +27,9 @@ var EventTarget = require("../cocos2d/core/event/event-target"); /** - *

cc.Sprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_graphics) )
+ *

_ccsg.Sprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_graphics) )
* - * cc.Sprite can be created with an image, or with a sub-rectangle of an image.
+ * _ccsg.Sprite can be created with an image, or with a sub-rectangle of an image.
* * If the parent or any of its ancestors is a cc.SpriteBatchNode then the following features/limitations are valid
* - Features when the parent is a cc.BatchNode:
@@ -42,12 +42,12 @@ var EventTarget = require("../cocos2d/core/event/event-target"); * - The Blending function property belongs to CCSpriteBatchNode, so you can't individually set the blending function property.
* - Parallax scroller is not supported, but can be simulated with a "proxy" sprite.
* - * If the parent is an standard ccsg.Node, then cc.Sprite behaves like any other ccsg.Node:
+ * If the parent is an standard ccsg.Node, then _ccsg.Sprite behaves like any other ccsg.Node:
* - It supports blending functions
* - It supports aliasing / antialiasing
* - But the rendering will be slower: 1 draw per children.
* - * The default anchorPoint in cc.Sprite is (0.5, 0.5).

+ * The default anchorPoint in _ccsg.Sprite is (0.5, 0.5).

* @class * @extends _ccsg.Node * @@ -57,21 +57,21 @@ var EventTarget = require("../cocos2d/core/event/event-target"); * @example * * 1.Create a sprite with image path and rect - * var sprite1 = new cc.Sprite("res/HelloHTML5World.png"); - * var sprite2 = new cc.Sprite("res/HelloHTML5World.png",cc.rect(0,0,480,320)); + * var sprite1 = new _ccsg.Sprite("res/HelloHTML5World.png"); + * var sprite2 = new _ccsg.Sprite("res/HelloHTML5World.png",cc.rect(0,0,480,320)); * * 2.Create a sprite with a sprite frame name. Must add "#" before frame name. - * var sprite = new cc.Sprite('#grossini_dance_01.png'); + * var sprite = new _ccsg.Sprite('#grossini_dance_01.png'); * * 3.Create a sprite with a sprite frame * var spriteFrame = cc.spriteFrameCache.getSpriteFrame("grossini_dance_01.png"); - * var sprite = new cc.Sprite(spriteFrame); + * var sprite = new _ccsg.Sprite(spriteFrame); * * 4.Create a sprite with an existing texture contained in a CCTexture2D object * After creation, the rect will be the size of the texture, and the offset will be (0,0). * var texture = cc.textureCache.addImage("HelloHTML5World.png"); - * var sprite1 = new cc.Sprite(texture); - * var sprite2 = new cc.Sprite(texture, cc.rect(0,0,480,320)); + * var sprite1 = new _ccsg.Sprite(texture); + * var sprite2 = new _ccsg.Sprite(texture, cc.rect(0,0,480,320)); * * @property {Boolean} dirty - Indicates whether the sprite needs to be updated. * @property {Boolean} flippedX - Indicates whether or not the sprite is flipped on x axis. @@ -85,7 +85,7 @@ var EventTarget = require("../cocos2d/core/event/event-target"); * @property {cc.SpriteBatchNode} batchNode - The batch node object if this sprite is rendered by cc.SpriteBatchNode. * @property {cc.V3F_C4B_T2F_Quad} quad - <@readonly> The quad (tex coords, vertex coords and color) information. */ -cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ +_ccsg.Sprite = _ccsg.Node.extend({ dirty:false, atlasIndex:0, textureAtlas:null, @@ -196,7 +196,7 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ }, /** - * Returns the rect of the cc.Sprite in points + * Returns the rect of the _ccsg.Sprite in points * @return {cc.Rect} */ getTextureRect:function () { @@ -273,7 +273,7 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ * @param {String} spriteFrameName A key string that can fected a valid cc.SpriteFrame from cc.SpriteFrameCache * @return {Boolean} true if the sprite is initialized properly, false otherwise. * @example - * var sprite = new cc.Sprite(); + * var sprite = new _ccsg.Sprite(); * sprite.initWithSpriteFrameName("grossini_dance_01.png"); */ initWithSpriteFrameName:function (spriteFrameName) { @@ -556,7 +556,7 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ _softInit: function (fileName, rect, rotated) { if (fileName === undefined) - cc.Sprite.prototype.init.call(this); + _ccsg.Sprite.prototype.init.call(this); else if (cc.js.isString(fileName)) { if (fileName[0] === "#") { // Init with a sprite frame name @@ -568,7 +568,7 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ cc.log("%s does not exist", fileName); } else { // Init with filename and rect - cc.Sprite.prototype.init.call(this, fileName, rect); + _ccsg.Sprite.prototype.init.call(this, fileName, rect); } } else if (typeof fileName === "object") { if (fileName instanceof cc.Texture2D) { @@ -800,7 +800,7 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ /** * Add child to sprite (override ccsg.Node) * @function - * @param {cc.Sprite} child + * @param {_ccsg.Sprite} child * @param {Number} localZOrder child's zOrder * @param {String} [tag] child's tag * @override @@ -909,7 +909,7 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ * @param {cc.SpriteBatchNode|null} spriteBatchNode * @example * var batch = new cc.SpriteBatchNode("Images/grossini_dance_atlas.png", 15); - * var sprite = new cc.Sprite(batch.texture, cc.rect(0, 0, 57, 57)); + * var sprite = new _ccsg.Sprite(batch.texture, cc.rect(0, 0, 57, 57)); * batch.addChild(sprite); * layer.addChild(batch); */ @@ -919,7 +919,7 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ // self render if (!_t._batchNode) { - _t.atlasIndex = cc.Sprite.INDEX_NOT_INITIALIZED; + _t.atlasIndex = _ccsg.Sprite.INDEX_NOT_INITIALIZED; _t.textureAtlas = null; _t._recursiveDirty = false; _t.dirty = false; @@ -981,53 +981,53 @@ cc.Sprite = _ccsg.Node.extend(/** @lends cc.Sprite# */{ _createRenderCmd: function(){ if(cc._renderType === cc.game.RENDER_TYPE_CANVAS) - return new cc.Sprite.CanvasRenderCmd(this); + return new _ccsg.Sprite.CanvasRenderCmd(this); else - return new cc.Sprite.WebGLRenderCmd(this); + return new _ccsg.Sprite.WebGLRenderCmd(this); } }); /** * Create a sprite with image path or frame name or texture or spriteFrame. * @deprecated since v3.0, please use new construction instead - * @see cc.Sprite + * @see _ccsg.Sprite * @param {String|cc.SpriteFrame|HTMLImageElement|cc.Texture2D} fileName The string which indicates a path to image file, e.g., "scene1/monster.png". * @param {cc.Rect} rect Only the contents inside rect of pszFileName's texture will be applied for this sprite. * @param {Boolean} [rotated] Whether or not the texture rectangle is rotated. - * @return {cc.Sprite} A valid sprite object + * @return {_ccsg.Sprite} A valid sprite object */ -cc.Sprite.create = function (fileName, rect, rotated) { - return new cc.Sprite(fileName, rect, rotated); +_ccsg.Sprite.create = function (fileName, rect, rotated) { + return new _ccsg.Sprite(fileName, rect, rotated); }; /** * @deprecated since v3.0, please use new construction instead - * @see cc.Sprite + * @see _ccsg.Sprite * @function */ -cc.Sprite.createWithTexture = cc.Sprite.create; +_ccsg.Sprite.createWithTexture = _ccsg.Sprite.create; /** * @deprecated since v3.0, please use new construction instead - * @see cc.Sprite + * @see _ccsg.Sprite * @function */ -cc.Sprite.createWithSpriteFrameName = cc.Sprite.create; +_ccsg.Sprite.createWithSpriteFrameName = _ccsg.Sprite.create; /** * @deprecated since v3.0, please use new construction instead - * @see cc.Sprite + * @see _ccsg.Sprite * @function */ -cc.Sprite.createWithSpriteFrame = cc.Sprite.create; +_ccsg.Sprite.createWithSpriteFrame = _ccsg.Sprite.create; /** - * cc.Sprite invalid index on the cc.SpriteBatchNode + * _ccsg.Sprite invalid index on the cc.SpriteBatchNode * @constant * @type {Number} */ -cc.Sprite.INDEX_NOT_INITIALIZED = -1; +_ccsg.Sprite.INDEX_NOT_INITIALIZED = -1; -cc.js.addon(cc.Sprite.prototype, EventTarget.prototype); +cc.js.addon(_ccsg.Sprite.prototype, EventTarget.prototype); cc.assert(cc.js.isFunction(cc._tmp.PrototypeSprite), cc._LogInfos.MissingFile, "SpritesPropertyDefine.js"); diff --git a/cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js b/cocos2d/core/sprites/CCSGSpriteCanvasRenderCmd.js similarity index 95% rename from cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js rename to cocos2d/core/sprites/CCSGSpriteCanvasRenderCmd.js index 7821d189d3..df177ee33a 100644 --- a/cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js +++ b/cocos2d/core/sprites/CCSGSpriteCanvasRenderCmd.js @@ -23,7 +23,7 @@ ****************************************************************************/ (function() { - cc.Sprite.CanvasRenderCmd = function (renderable) { + _ccsg.Sprite.CanvasRenderCmd = function (renderable) { _ccsg.Node.CanvasRenderCmd.call(this, renderable); this._needDraw = true; this._textureCoord = { @@ -41,8 +41,8 @@ this._textureToRender = null; }; - var proto = cc.Sprite.CanvasRenderCmd.prototype = Object.create(_ccsg.Node.CanvasRenderCmd.prototype); - proto.constructor = cc.Sprite.CanvasRenderCmd; + var proto = _ccsg.Sprite.CanvasRenderCmd.prototype = Object.create(_ccsg.Node.CanvasRenderCmd.prototype); + proto.constructor = _ccsg.Sprite.CanvasRenderCmd; proto._init = function () {}; @@ -85,7 +85,7 @@ proto._handleTextureForRotatedTexture = function (texture, rect, rotated, counterclockwise) { if (rotated && texture.isLoaded()) { var tempElement = texture.getHtmlElementObj(); - tempElement = cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(tempElement, rect, counterclockwise); + tempElement = _ccsg.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(tempElement, rect, counterclockwise); var tempTexture = new cc.Texture2D(); tempTexture.initWithElement(tempElement); tempTexture.handleLoadedTexture(); @@ -222,7 +222,7 @@ if (!locParent || locParent === node._batchNode) { node._transformToBatch = _t.getNodeToParentTransform(); } else { - //cc.assert(_t._parent instanceof cc.Sprite, "Logic error in CCSprite. Parent must be a CCSprite"); + //cc.assert(_t._parent instanceof _ccsg.Sprite, "Logic error in CCSprite. Parent must be a CCSprite"); node._transformToBatch = cc.affineTransformConcat(_t.getNodeToParentTransform(), locParent._transformToBatch); } } @@ -289,7 +289,7 @@ locTextureRect.validRect = !(locTextureRect.width === 0 || locTextureRect.height === 0 || locTextureRect.x < 0 || locTextureRect.y < 0); }; - cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas = function (texture, rect, counterclockwise) { + _ccsg.Sprite.CanvasRenderCmd._cutRotateImageToCanvas = function (texture, rect, counterclockwise) { if (!texture) return null; diff --git a/cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js b/cocos2d/core/sprites/CCSGSpriteWebGLRenderCmd.js similarity index 97% rename from cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js rename to cocos2d/core/sprites/CCSGSpriteWebGLRenderCmd.js index 9abb711e49..5d3eafa44f 100644 --- a/cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js +++ b/cocos2d/core/sprites/CCSGSpriteWebGLRenderCmd.js @@ -24,7 +24,7 @@ //Sprite's WebGL render command (function() { - cc.Sprite.WebGLRenderCmd = function (renderable) { + _ccsg.Sprite.WebGLRenderCmd = function (renderable) { _ccsg.Node.WebGLRenderCmd.call(this, renderable); this._needDraw = true; @@ -35,8 +35,8 @@ this._recursiveDirty = false; }; - var proto = cc.Sprite.WebGLRenderCmd.prototype = Object.create(_ccsg.Node.WebGLRenderCmd.prototype); - proto.constructor = cc.Sprite.WebGLRenderCmd; + var proto = _ccsg.Sprite.WebGLRenderCmd.prototype = Object.create(_ccsg.Node.WebGLRenderCmd.prototype); + proto.constructor = _ccsg.Sprite.WebGLRenderCmd; proto.updateBlendFunc = function (blendFunc) {}; @@ -52,14 +52,14 @@ var locChildren = this._node._children, child, l = locChildren ? locChildren.length : 0; for (var i = 0; i < l; i++) { child = locChildren[i]; - (child instanceof cc.Sprite) && child._renderCmd.setDirtyRecursively(value); + (child instanceof _ccsg.Sprite) && child._renderCmd.setDirtyRecursively(value); } }; proto._setBatchNodeForAddChild = function (child) { var node = this._node; if (node._batchNode) { - if (!(child instanceof cc.Sprite)) { + if (!(child instanceof _ccsg.Sprite)) { cc.log(cc._LogInfos.Sprite.addChild); return false; } @@ -261,7 +261,7 @@ // renders using Sprite Manager if (node._batchNode) { - if (node.atlasIndex !== cc.Sprite.INDEX_NOT_INITIALIZED) { + if (node.atlasIndex !== _ccsg.Sprite.INDEX_NOT_INITIALIZED) { node.textureAtlas.updateQuad(locQuad, node.atlasIndex) } else { // no need to set it recursively @@ -430,7 +430,7 @@ return; var gl = ctx || cc._renderContext ; - //cc.assert(!_t._batchNode, "If cc.Sprite is being rendered by cc.SpriteBatchNode, cc.Sprite#draw SHOULD NOT be called"); + //cc.assert(!_t._batchNode, "If _ccsg.Sprite is being rendered by cc.SpriteBatchNode, _ccsg.Sprite#draw SHOULD NOT be called"); if (locTexture) { if (locTexture._textureLoaded) { diff --git a/cocos2d/core/sprites/CCSpriteBatchNode.js b/cocos2d/core/sprites/CCSpriteBatchNode.js index 8d499f3bdd..6a081e1e5a 100644 --- a/cocos2d/core/sprites/CCSpriteBatchNode.js +++ b/cocos2d/core/sprites/CCSpriteBatchNode.js @@ -33,7 +33,7 @@ * If the cc.Sprites are not added to a cc.SpriteBatchNode then an WebGL draw call will be needed for each one, which is less efficient.
*
* Limitations:
- * - The only object that is accepted as child (or grandchild, grand-grandchild, etc...) is cc.Sprite or any subclass of cc.Sprite.
+ * - The only object that is accepted as child (or grandchild, grand-grandchild, etc...) is _ccsg.Sprite or any subclass of _ccsg.Sprite.
* eg: particles, labels and layer can't be added to a cc.SpriteBatchNode.
* - Either all its children are Aliased or Antialiased. It can't be a mix.
* This is because "alias" is a property of the texture, and all the sprites share the same texture.
@@ -83,7 +83,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ * This is the opposite of "addQuadFromSprite.
* It add the sprite to the children and descendants array, but it doesn't update add it to the texture atlas
*

- * @param {cc.Sprite} child + * @param {_ccsg.Sprite} child * @param {Number} z zOrder * @param {Number} aTag * @return {cc.SpriteBatchNode} @@ -91,7 +91,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ addSpriteWithoutQuad: function (child, z, aTag) { cc.assert(child, cc._LogInfos.SpriteBatchNode.addSpriteWithoutQuad_2); - if (!(child instanceof cc.Sprite)) { + if (!(child instanceof _ccsg.Sprite)) { cc.log(cc._LogInfos.SpriteBatchNode.addSpriteWithoutQuad); return null; } @@ -203,7 +203,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Rebuild index in order for child - * @param {cc.Sprite} pobParent + * @param {_ccsg.Sprite} pobParent * @param {Number} index * @return {Number} */ @@ -233,7 +233,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Returns highest atlas index in child - * @param {cc.Sprite} sprite + * @param {_ccsg.Sprite} sprite * @return {Number} */ highestAtlasIndexInChild: function (sprite) { @@ -247,7 +247,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Returns lowest atlas index in child - * @param {cc.Sprite} sprite + * @param {_ccsg.Sprite} sprite * @return {Number} */ lowestAtlasIndexInChild: function (sprite) { @@ -260,7 +260,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Returns atlas index for child - * @param {cc.Sprite} sprite + * @param {_ccsg.Sprite} sprite * @param {Number} nZ * @return {Number} */ @@ -282,8 +282,8 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ return this.highestAtlasIndexInChild(previous) + 1; } - // parent is a cc.Sprite, so, it must be taken into account - // first child of an cc.Sprite ? + // parent is a _ccsg.Sprite, so, it must be taken into account + // first child of an _ccsg.Sprite ? if (childIndex === 0) { // less than parent and brothers if (nZ < 0) @@ -331,7 +331,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Reorder children (override reorderChild of ccsg.Node) * @override - * @param {cc.Sprite} child + * @param {_ccsg.Sprite} child * @param {Number} zOrder */ reorderChild: function (child, zOrder) { @@ -350,7 +350,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Removes a child from cc.SpriteBatchNode (override removeChild of ccsg.Node) - * @param {cc.Sprite} child + * @param {_ccsg.Sprite} child * @param {Boolean} cleanup */ removeChild: function (child, cleanup) { @@ -370,16 +370,16 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** *

* Updates a quad at a certain index into the texture atlas. The CCSprite won't be added into the children array.
- * This method should be called only when you are dealing with very big AtlasSrite and when most of the cc.Sprite won't be updated.
+ * This method should be called only when you are dealing with very big AtlasSrite and when most of the _ccsg.Sprite won't be updated.
* For example: a tile map (cc.TMXMap) or a label with lots of characters (BitmapFontAtlas)
*

* @function - * @param {cc.Sprite} sprite + * @param {_ccsg.Sprite} sprite * @param {Number} index */ updateQuadFromSprite: function (sprite, index) { cc.assert(sprite, cc._LogInfos.SpriteBatchNode.updateQuadFromSprite_2); - if (!(sprite instanceof cc.Sprite)) { + if (!(sprite instanceof _ccsg.Sprite)) { cc.log(cc._LogInfos.SpriteBatchNode.updateQuadFromSprite); return; } @@ -397,17 +397,17 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** *

- * Inserts a quad at a certain index into the texture atlas. The cc.Sprite won't be added into the children array.
- * This method should be called only when you are dealing with very big AtlasSprite and when most of the cc.Sprite won't be updated.
+ * Inserts a quad at a certain index into the texture atlas. The _ccsg.Sprite won't be added into the children array.
+ * This method should be called only when you are dealing with very big AtlasSprite and when most of the _ccsg.Sprite won't be updated.
* For example: a tile map (cc.TMXMap) or a label with lots of characters (cc.LabelBMFont) *

* @function - * @param {cc.Sprite} sprite + * @param {_ccsg.Sprite} sprite * @param {Number} index */ insertQuadFromSprite: function (sprite, index) { cc.assert(sprite, cc._LogInfos.SpriteBatchNode.insertQuadFromSprite_2); - if (!(sprite instanceof cc.Sprite)) { + if (!(sprite instanceof _ccsg.Sprite)) { cc.log(cc._LogInfos.SpriteBatchNode.insertQuadFromSprite); return; } @@ -448,7 +448,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Insert a child - * @param {cc.Sprite} sprite The child sprite + * @param {_ccsg.Sprite} sprite The child sprite * @param {Number} index The insert index */ insertChild: function (sprite, index) { @@ -483,7 +483,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Add child at the end, faster than insert child * @function - * @param {cc.Sprite} sprite + * @param {_ccsg.Sprite} sprite */ appendChild: function (sprite) { this._reorderChildDirty = true; @@ -505,7 +505,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ /** * Removes sprite from TextureAtlas * @function - * @param {cc.Sprite} sprite + * @param {_ccsg.Sprite} sprite */ removeSpriteFromAtlas: function (sprite) { this._renderCmd.removeQuadAtIndex(sprite.atlasIndex); @@ -555,7 +555,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{ * Add child to the sprite batch node (override addChild of ccsg.Node) * @function * @override - * @param {cc.Sprite} child + * @param {_ccsg.Sprite} child * @param {Number} [zOrder] * @param {Number} [tag] */ diff --git a/cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js b/cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js index 5c2b558b08..9d0068bde3 100644 --- a/cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js +++ b/cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js @@ -37,7 +37,7 @@ proto.checkAtlasCapacity = function(){}; proto.isValidChild = function(child){ - if (!(child instanceof cc.Sprite)) { + if (!(child instanceof _ccsg.Sprite)) { cc.log(cc._LogInfos.Sprite.addChild_4); return false; } diff --git a/cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js b/cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js index 18c4bd0ac5..c3251a5b6b 100644 --- a/cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js +++ b/cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js @@ -35,7 +35,7 @@ proto.constructor = cc.SpriteBatchNode.WebGLRenderCmd; proto.isValidChild = function(child){ - if (!(child instanceof cc.Sprite)) { + if (!(child instanceof _ccsg.Sprite)) { cc.log(cc._LogInfos.Sprite.addChild_4); return false; } diff --git a/cocos2d/core/sprites/CCSpriteFrame.js b/cocos2d/core/sprites/CCSpriteFrame.js index 8c3f918bb6..aa2b42ceba 100644 --- a/cocos2d/core/sprites/CCSpriteFrame.js +++ b/cocos2d/core/sprites/CCSpriteFrame.js @@ -31,10 +31,10 @@ var EventTarget = require("../event/event-target"); /** *

* A cc.SpriteFrame has:
- * - texture: A cc.Texture2D that will be used by the cc.Sprite
+ * - texture: A cc.Texture2D that will be used by the _ccsg.Sprite
* - rectangle: A rectangle of the texture
*
- * You can modify the frame of a cc.Sprite by doing:
+ * You can modify the frame of a _ccsg.Sprite by doing:
*

* @class SpriteFrame * @extends Asset @@ -323,7 +323,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{ this._textureLoaded = true; if(this._rotated && cc._renderType === cc.game.RENDER_TYPE_CANVAS){ var tempElement = sender.getHtmlElementObj(); - tempElement = cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(tempElement, this.getRect()); + tempElement = _ccsg.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(tempElement, this.getRect()); var tempTexture = new cc.Texture2D(); tempTexture.initWithElement(tempElement); tempTexture.handleLoadedTexture(); diff --git a/cocos2d/core/sprites/CCSpriteFrameCache.js b/cocos2d/core/sprites/CCSpriteFrameCache.js index 9b7f0891f6..c1e6249c2e 100644 --- a/cocos2d/core/sprites/CCSpriteFrameCache.js +++ b/cocos2d/core/sprites/CCSpriteFrameCache.js @@ -185,7 +185,7 @@ cc.spriteFrameCache = /** @lends cc.spriteFrameCache# */{ var locTexture = spriteFrame.getTexture(); if (locTexture.isLoaded()) { var tempElement = spriteFrame.getTexture().getHtmlElementObj(); - tempElement = cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(tempElement, spriteFrame.getRectInPixels()); + tempElement = _ccsg.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(tempElement, spriteFrame.getRectInPixels()); var tempTexture = new cc.Texture2D(); tempTexture.initWithElement(tempElement); tempTexture.handleLoadedTexture(); diff --git a/cocos2d/core/sprites/SpritesPropertyDefine.js b/cocos2d/core/sprites/SpritesPropertyDefine.js index 20e8cc938a..59517de287 100644 --- a/cocos2d/core/sprites/SpritesPropertyDefine.js +++ b/cocos2d/core/sprites/SpritesPropertyDefine.js @@ -25,7 +25,7 @@ ****************************************************************************/ cc._tmp.PrototypeSprite = function () { - var _p = cc.Sprite.prototype; + var _p = _ccsg.Sprite.prototype; // Override properties cc.defineGetterSetter(_p, "opacityModifyRGB", _p.isOpacityModifyRGB, _p.setOpacityModifyRGB); diff --git a/cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js b/cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js index f78d2f3f1e..3d3df03694 100644 --- a/cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js +++ b/cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js @@ -59,7 +59,7 @@ var c = locString.charCodeAt(i); var fontChar = node.getChildByTag(i); if (!fontChar) { - fontChar = new cc.Sprite(); + fontChar = new _ccsg.Sprite(); if (c === 32) { fontChar.init(); fontChar.setTextureRect(cc.rect(0, 0, 10, 10), false, cc.size(0, 0)); diff --git a/cocos2d/labels/CCLabelBMFont.js b/cocos2d/labels/CCLabelBMFont.js index 20ac961dc4..9ab4f2f828 100644 --- a/cocos2d/labels/CCLabelBMFont.js +++ b/cocos2d/labels/CCLabelBMFont.js @@ -42,7 +42,7 @@ cc.LABEL_AUTOMATIC_WIDTH = -1; *

cc.LabelBMFont is a subclass of cc.SpriteBatchNode.

* *

Features:
- *