Class cc.AtlasNode
- Defined in: CCAtlasNode.js
- Extends cc.Node
Constructor Attributes | Constructor Name and Description |
---|---|
cc.AtlasNode(tile, tileWidth, tileHeight, itemsToRender)
cc.AtlasNode is a subclass of cc.Node, it knows how to render a TextureAtlas object. |
Method Summary
Class Detail
cc.AtlasNode(tile, tileWidth, tileHeight, itemsToRender)
cc.AtlasNode is a subclass of cc.Node, it knows how to render a TextureAtlas object.
If you are going to render a TextureAtlas consider subclassing cc.AtlasNode (or a subclass of cc.AtlasNode)
All features from cc.Node are valid
You can create a cc.AtlasNode with an Atlas file, the width, the height of each item and the quantity of items to render
var node = new cc.AtlasNode("pathOfTile", 16, 16, 1);
- Parameters:
- {String} tile
- {Number} tileWidth
- {Number} tileHeight
- {Number} itemsToRender
Field Detail
{Number}
quadsToDraw
- Number of quads to draw
{cc.Texture2D}
texture
- Current used texture
{cc.TextureAtlas}
textureAtlas
- Texture atlas for cc.AtlasNode
Method Detail
-
Creates a cc.AtlasNode with an Atlas file the width and height of each item and the quantity of items to render
- Parameters:
- {String} tile
- {Number} tileWidth
- {Number} tileHeight
- {Number} itemsToRender
- Deprecated:
- since v3.0, please use new construction instead
- Returns:
- {cc.AtlasNode}
-
ctor(tile, tileWidth, tileHeight, itemsToRender)
Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- Parameters:
- {String} tile
- {Number} tileWidth
- {Number} tileHeight
- {Number} itemsToRender
-
{cc.BlendFunc} getBlendFunc()Get node's blend function
- Returns:
- {cc.BlendFunc}
-
{cc.Color} getColor()Get color value of the atlas node
- Returns:
- {cc.Color}
-
{Number} getQuadsToDraw()Get the number of quads to be rendered
- Returns:
- {Number}
-
{cc.Texture2D} getTexture()Get the current texture
- Returns:
- {cc.Texture2D}
-
{cc.TextureAtlas} getTextureAtlas()Get the atlas texture
- Returns:
- {cc.TextureAtlas}
-
{Boolean} initWithTexture(texture, tileWidth, tileHeight, itemsToRender)Initializes an CCAtlasNode with an atlas texture, the width, the height of each tile and the quantity of tiles to render
- Parameters:
- {cc.Texture2D} texture
- The atlas texture
- {Number} tileWidth
- The width of each tile
- {Number} tileHeight
- The height of each tile
- {Number} itemsToRender
- The quantity of tiles to be rendered
- Returns:
- {Boolean}
-
{Boolean} initWithTileFile(tile, tileWidth, tileHeight, itemsToRender)Initializes an cc.AtlasNode object with an atlas texture file name, the width, the height of each tile and the quantity of tiles to render
- Parameters:
- {String} tile
- The atlas texture file name
- {Number} tileWidth
- The width of each tile
- {Number} tileHeight
- The height of each tile
- {Number} itemsToRender
- The quantity of tiles to be rendered
- Returns:
- {Boolean}
-
{Boolean} isOpacityModifyRGB()Get whether color should be changed with the opacity value
- Returns:
- {Boolean}
-
setBlendFunc(src, dst)Set node's blend function This function accept either cc.BlendFunc object or source value and destination value
- Parameters:
- {Number | cc.BlendFunc} src
- {Number} dst
-
setColor(color)Set node's color
- Parameters:
- {cc.Color} color
- Color object created with cc.color(r, g, b).
-
setOpacity(opacity)Set node's opacity
- Parameters:
- {Number} opacity
- The opacity value
-
setOpacityModifyRGB(value)Set whether color should be changed with the opacity value, if true, node color will change while opacity changes.
- Parameters:
- {Boolean} value
-
setQuadsToDraw(quadsToDraw)Set the number of quads to be rendered
- Parameters:
- {Number} quadsToDraw
-
setTexture(texture)Replace the current texture with a new one
- Parameters:
- {cc.Texture2D} texture
- The new texture
-
setTextureAtlas(value)Set the atlas texture
- Parameters:
- {cc.TextureAtlas} value
- The texture
-
updateAtlasValues()Updates the Atlas (indexed vertex array). Empty implementation, shall be overridden in subclasses