Class Index | File Index

Classes


Class cc.LabelTTF


Extends cc.Sprite.

Defined in: CCLabelTTF.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.LabelTTF is a subclass of cc.TextureNode that knows how to render text labels
All features from cc.TextureNode are valid in cc.LabelTTF
cc.LabelTTF objects are slow for js-binding on mobile devices.
Method Summary
Method Attributes Method Name and Description
<static>  
cc.LabelTTF.create(label, fontName, fontSize, dimensions, alignment)
creates a cc.LabelTTF from a fontname, alignment, dimension and font size
 
ctor()
Constructor
 
Prints out a description of this class
 
draw(ctx)
renders the label
 
return Dimensions of cc.LabelTTF
 
return font name of cc.LabelTTF
 
return font size of cc.LabelTTF
 
return Horizontal Alignment of cc.LabelTTF
 
returns the text of the label
 
return Vertical Alignment of cc.LabelTTF
 
init(callsuper)
 
initWithString(initialize, fontName, fontSize, dimensions, alignment)
initializes the cc.LabelTTF with a font name, alignment, dimension and font size
<static>  
cc.LabelTTF.node()
 
setColor(color3)
 
set Dimensions of cc.LabelTTF
 
setFontName(fontName)
set font name of cc.LabelTTF
 
setFontSize(fontSize)
set font size of cc.LabelTTF
 
set Horizontal Alignment of cc.LabelTTF
 
setOpacity(opacity)
 
setString(string)
changes the string to render
 
setVerticalAlignment(verticalAlignment)
set Vertical Alignment of cc.LabelTTF
Methods borrowed from class cc.Sprite:
addChild, displayFrame, getAtlasIndex, getBatchNode, getBlendFunc, getColor, getOffsetPosition, getOpacity, getQuad, getSpriteBatchNode, getTexture, getTextureAtlas, getTextureRect, ignoreAnchorPointForPosition, initWithFile, initWithSpriteFrame, initWithSpriteFrameName, initWithTexture, isDirty, isFlippedX, isFlippedY, isFrameDisplayed, isOpacityModifyRGB, isTextureRectRotated, removeAllChildren, removeChild, reorderChild, SET_DIRTY_RECURSIVELY, setAnchorPoint, setAtlasIndex, setBatchNode, setBlendFunc, setDirty, setDirtyRecursively, setDisplayFrame, setDisplayFrameWithAnimationName, setFlipX, setFlipY, setOpacityModifyRGB, setPosition, setRotation, setScale, setScaleX, setScaleY, setSkewX, setSkewY, setSpriteBatchNode, setTexture, setTextureAtlas, setTextureRect, setVertexRect, setVertexZ, setVisible, sortAllChildren, updateColor, updateTransform, useBatchNode
Methods borrowed from class cc.Node:
cleanup, convertToNodeSpace, convertToNodeSpaceAR, convertTouchToNodeSpace, convertTouchToNodeSpaceAR, convertToWorldSpace, convertToWorldSpaceAR, getActionByTag, getActionManager, getAnchorPoint, getAnchorPointInPoints, getBoundingBox, getBoundingBoxToWorld, getCamera, getChildByTag, getChildren, getChildrenCount, getContentSize, getGLServerState, getGrid, getOrderOfArrival, getParent, getPosition, getPositionX, getPositionY, getRotation, getScale, getScaleX, getScaleY, getScheduler, getShaderProgram, getSkewX, getSkewY, getTag, getUserData, getUserObject, getVertexZ, getZOrder, isIgnoreAnchorPointForPosition, isRunning, isVisible, nodeToParentTransform, nodeToWorldTransform, numberOfRunningActions, onEnter, onEnterTransitionDidFinish, onExit, onExitTransitionDidStart, parentToNodeTransform, pauseSchedulerAndActions, release, removeAllChildrenWithCleanup, removeChildByTag, removeFromParent, removeFromParentAndCleanup, resumeSchedulerAndActions, retain, runAction, schedule, scheduleOnce, scheduleUpdate, scheduleUpdateWithPriority, setActionManager, setContentSize, setGLServerState, setGrid, setNodeDirty, setOrderOfArrival, setParent, setPositionX, setPositionY, setScheduler, setShaderProgram, setTag, setUserData, setUserObject, setZOrder, stopAction, stopActionByTag, stopAllActions, transform, transformAncestors, unschedule, unscheduleAllCallbacks, unscheduleUpdate, update, visit, worldToNodeTransform
Class Detail
cc.LabelTTF()
cc.LabelTTF is a subclass of cc.TextureNode that knows how to render text labels
All features from cc.TextureNode are valid in cc.LabelTTF
cc.LabelTTF objects are slow for js-binding on mobile devices.
Consider using cc.LabelAtlas or cc.LabelBMFont instead.
Method Detail
<static> {cc.LabelTTF|Null} cc.LabelTTF.create(label, fontName, fontSize, dimensions, alignment)
creates a cc.LabelTTF from a fontname, alignment, dimension and font size
// Example
var myLabel = cc.LabelTTF.create('label text',  'Times New Roman', 32, cc.size(32,16), cc.TEXT_ALIGNMENT_LEFT);
Parameters:
{String} label
{String} fontName
{Number} fontSize
{cc.Size} dimensions
{cc.TEXT_ALIGNMENT_LEFT|cc.TEXT_ALIGNMENT_CENTER|cc.TEXT_ALIGNMENT_RIGHT} alignment
Returns:
{cc.LabelTTF|Null}

ctor()
Constructor

{String} description()
Prints out a description of this class
Returns:
{String}

draw(ctx)
renders the label
Parameters:
{CanvasContext|Null} ctx

{cc.Size} getDimensions()
return Dimensions of cc.LabelTTF
Returns:
{cc.Size}

{String} getFontName()
return font name of cc.LabelTTF
Returns:
{String}

{Number} getFontSize()
return font size of cc.LabelTTF
Returns:
{Number}

{cc.TEXT_ALIGNMENT_LEFT|cc.TEXT_ALIGNMENT_CENTER|cc.TEXT_ALIGNMENT_RIGHT} getHorizontalAlignment()
return Horizontal Alignment of cc.LabelTTF
Returns:
{cc.TEXT_ALIGNMENT_LEFT|cc.TEXT_ALIGNMENT_CENTER|cc.TEXT_ALIGNMENT_RIGHT}

{String} getString()
returns the text of the label
Returns:
{String}

{cc.VERTICAL_TEXT_ALIGNMENT_TOP|cc.VERTICAL_TEXT_ALIGNMENT_CENTER|cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM} getVerticalAlignment()
return Vertical Alignment of cc.LabelTTF
Returns:
{cc.VERTICAL_TEXT_ALIGNMENT_TOP|cc.VERTICAL_TEXT_ALIGNMENT_CENTER|cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM}

init(callsuper)
Parameters:
callsuper

{Boolean} initWithString(initialize, fontName, fontSize, dimensions, alignment)
initializes the cc.LabelTTF with a font name, alignment, dimension and font size
Parameters:
{String} initialize
string
{String} fontName
{Number} fontSize
{cc.Size} dimensions
{cc.TEXT_ALIGNMENT_LEFT|cc.TEXT_ALIGNMENT_CENTER|cc.TEXT_ALIGNMENT_RIGHT} alignment
Returns:
{Boolean} return false on error

<static> cc.LabelTTF.node()

setColor(color3)
Parameters:
color3

setDimensions(dim)
set Dimensions of cc.LabelTTF
Parameters:
{cc.Size} dim

setFontName(fontName)
set font name of cc.LabelTTF
Parameters:
{String} fontName

setFontSize(fontSize)
set font size of cc.LabelTTF
Parameters:
{Number} fontSize

setHorizontalAlignment(Horizontal)
set Horizontal Alignment of cc.LabelTTF
Parameters:
{cc.TEXT_ALIGNMENT_LEFT|cc.TEXT_ALIGNMENT_CENTER|cc.TEXT_ALIGNMENT_RIGHT} Horizontal
Alignment

setOpacity(opacity)
Parameters:
opacity

setString(string)
changes the string to render
Parameters:
{String} string
text for the label

setVerticalAlignment(verticalAlignment)
set Vertical Alignment of cc.LabelTTF
Parameters:
{cc.VERTICAL_TEXT_ALIGNMENT_TOP|cc.VERTICAL_TEXT_ALIGNMENT_CENTER|cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM} verticalAlignment

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 09 2013 07:51:51 GMT-0800 (PST)