Class cc.LabelAtlas
- Defined in: CCLabelAtlas.js
- Extends cc.AtlasNode
Constructor Attributes | Constructor Name and Description |
---|---|
cc.LabelAtlas(strText, charMapFile, itemWidth, itemHeight, startCharMap)
using image file to print text label on the screen, might be a bit slower than cc.Label, similar to cc.LabelBMFont
|
Method Summary
Class Detail
//creates the cc.LabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas var myLabel = new cc.LabelAtlas('Text to display', 'CharMapfile.png', 12, 20, ' ') //creates the cc.LabelAtlas with a string, a fnt file var myLabel = new cc.LabelAtlas('Text to display', 'CharMapFile.plist‘);
- Parameters:
- {String} strText
- {String} charMapFile
- charMapFile or fntFile
- {Number} itemWidth Optional, Default: 0
- {Number} itemHeight Optional, Default: 0
- {Number} startCharMap Optional, Default: ""
Field Detail
Method Detail
-
addLoadedEventListener(callback, target)Add texture loaded event listener.
- Parameters:
- {Function} callback
- {cc.Node} target
- Deprecated:
- since 3.1, please use addEventListener instead
-
<static> {cc.LabelAtlas} cc.LabelAtlas.create(strText, charMapFile, itemWidth, itemHeight, startCharMap)
Please use new cc.LabelAtlas instead.
Create a label atlas.
It accepts two groups of parameters:
a) string, fntFile
b) label, textureFilename, width, height, startChar
- Parameters:
- {String} strText
- {String} charMapFile
- charMapFile or fntFile
- {Number} itemWidth Optional, Default: 0
- {Number} itemHeight Optional, Default: 0
- {Number} startCharMap Optional, Default: ""
- Deprecated:
- since v3.0 please use new cc.LabelAtlas
- Returns:
- {cc.LabelAtlas} returns the LabelAtlas object on success
-
ctor(strText, charMapFile, itemWidth, itemHeight, startCharMap)
Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
Create a label atlas.
It accepts two groups of parameters:
a) string, fntFile
b) label, textureFilename, width, height, startChar
- Parameters:
- {String} strText
- {String} charMapFile
- charMapFile or fntFile
- {Number} itemWidth Optional, Default: 0
- {Number} itemHeight Optional, Default: 0
- {Number} startCharMap Optional, Default: ""
-
{String} getString()return the text of this label
- Returns:
- {String}
-
{Boolean} initWithString(strText, charMapFile, itemWidth, itemHeight, startCharMap)
initializes the cc.LabelAtlas with a string, a char map file(the atlas),
the width and height of each element and the starting char of the atlas
It accepts two groups of parameters:
a) string, fntFile
b) label, textureFilename, width, height, startChar
- Parameters:
- {String} strText
- {String|cc.Texture2D} charMapFile
- charMapFile or fntFile or texture file
- {Number} itemWidth Optional, Default: 0
- {Number} itemHeight Optional, Default: 0
- {Number} startCharMap Optional, Default: ""
- Returns:
- {Boolean} returns true on success
-
setColor(color3)Set the color.
- Parameters:
- {cc.Color} color3
-
setString(label)set the display string
- Parameters:
- {String} label
-
{boolean} textureLoaded()Return texture is loaded.
- Returns:
- {boolean}
-
updateAtlasValues()Atlas generation