cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
CCLabelTTF Class Reference

#import <CCLabelTTF.h>

Inheritance diagram for CCLabelTTF:
Collaboration diagram for CCLabelTTF:

Instance Methods

(id) - initWithString:fontName:fontSize:
 
(id) - initWithString:fontName:fontSize:dimensions:hAlignment:
 
(id) - initWithString:fontName:fontSize:dimensions:hAlignment:lineBreakMode:
 
(id) - initWithString:fontName:fontSize:dimensions:hAlignment:vAlignment:
 
(id) - initWithString:fontName:fontSize:dimensions:hAlignment:vAlignment:lineBreakMode:
 
(void) - setString:
 
(id) - initWithString:dimensions:alignment:fontName:fontSize:
 
(id) - initWithString:dimensions:alignment:lineBreakMode:fontName:fontSize:
 
 Instance Methods inherited from CCSprite
(id) - initWithTexture:
 
(id) - initWithTexture:rect:
 
(id) - initWithTexture:rect:rotated:
 
(id) - initWithSpriteFrame:
 
(id) - initWithSpriteFrameName:
 
(id) - initWithFile:
 
(id) - initWithFile:rect:
 
(id) - initWithCGImage:key:
 
(void) - updateTransform
 
(void) - setTextureRect:
 
(void) - setTextureRect:rotated:untrimmedSize:
 
(void) - setVertexRect:
 
(void) - setDisplayFrame:
 
(BOOL) - isFrameDisplayed:
 
(CCSpriteFrame *) - displayFrame
 
(void) - setDisplayFrameWithAnimationName:index:
 
(id) - initWithBatchNode:rect:
 
(CCSpriteFrame *) - DEPRECATED_ATTRIBUTE
 
 Instance Methods inherited from CCNode
(id) - init
 
(void) - onEnter
 
(void) - onEnterTransitionDidFinish
 
(void) - onExit
 
(void) - onExitTransitionDidStart
 
(void) - addChild:
 
(void) - addChild:z:
 
(void) - addChild:z:tag:
 
(void) - removeFromParent
 
(void) - removeFromParentAndCleanup:
 
(void) - removeChild:
 
(void) - removeChild:cleanup:
 
(void) - removeChildByTag:
 
(void) - removeChildByTag:cleanup:
 
(void) - removeAllChildren
 
(void) - removeAllChildrenWithCleanup:
 
(CCNode *) - getChildByTag:
 
(void) - reorderChild:z:
 
(void) - sortAllChildren
 
(void) - cleanup
 
(void) - draw
 
(void) - visit
 
(void) - transform
 
(void) - transformAncestors
 
(CGRect) - boundingBox
 
(CCAction *) - runAction:
 
(void) - stopAllActions
 
(void) - stopAction:
 
(void) - stopActionByTag:
 
(CCAction *) - getActionByTag:
 
(NSUInteger) - numberOfRunningActions
 
(void) - scheduleUpdate
 
(void) - scheduleUpdateWithPriority:
 
(void) - unscheduleUpdate
 
(void) - schedule:
 
(void) - schedule:interval:
 
(void) - schedule:interval:repeat:delay:
 
(void) - scheduleOnce:delay:
 
(void) - unschedule:
 
(void) - unscheduleAllSelectors
 
(void) - resumeSchedulerAndActions
 
(void) - pauseSchedulerAndActions
 
(void) - update:
 
(CGAffineTransform) - nodeToParentTransform
 
(CGAffineTransform) - parentToNodeTransform
 
(CGAffineTransform) - nodeToWorldTransform
 
(CGAffineTransform) - worldToNodeTransform
 
(CGPoint) - convertToNodeSpace:
 
(CGPoint) - convertToWorldSpace:
 
(CGPoint) - convertToNodeSpaceAR:
 
(CGPoint) - convertToWorldSpaceAR:
 
(CGPoint) - convertTouchToNodeSpace:
 
(CGPoint) - convertTouchToNodeSpaceAR:
 
(void) - setIsRelativeAnchorPoint:
 
(void) - setZOrder:
 
 Instance Methods inherited from <CCRGBAProtocol>
(void) - setColor:
 
(ccColor3B- color
 
(GLubyte) - opacity
 returns the opacity
 
(void) - setOpacity:
 
(void) - setOpacityModifyRGB:
 
(BOOL) - doesOpacityModifyRGB
 
 Instance Methods inherited from <CCTextureProtocol>
(CCTexture2D *) - texture
 
(void) - setTexture:
 
 Instance Methods inherited from <CCBlendProtocol>
(void) - setBlendFunc:
 
(ccBlendFunc- blendFunc
 
 Instance Methods inherited from <CCLabelProtocol>
(NSString *) - string
 
(void) - setCString:
 

Class Methods

(id) + labelWithString:fontName:fontSize:
 
(id) + labelWithString:fontName:fontSize:dimensions:hAlignment:
 
(id) + labelWithString:fontName:fontSize:dimensions:hAlignment:lineBreakMode:
 
(id) + labelWithString:fontName:fontSize:dimensions:hAlignment:vAlignment:lineBreakMode:
 
(id) + labelWithString:fontName:fontSize:dimensions:hAlignment:vAlignment:
 
(id) + labelWithString:dimensions:alignment:fontName:fontSize:
 
(id) + labelWithString:dimensions:alignment:lineBreakMode:fontName:fontSize:
 
(id) + labelWithString:dimensions:hAlignment:fontName:fontSize:
 
(id) + labelWithString:dimensions:hAlignment:lineBreakMode:fontName:fontSize:
 
(id) + labelWithString:dimensions:hAlignment:vAlignment:lineBreakMode:fontName:fontSize:
 
(id) + labelWithString:dimensions:hAlignment:vAlignment:fontName:fontSize:
 
 Class Methods inherited from CCSprite
(id) + spriteWithTexture:
 
(id) + spriteWithTexture:rect:
 
(id) + spriteWithSpriteFrame:
 
(id) + spriteWithSpriteFrameName:
 
(id) + spriteWithFile:
 
(id) + spriteWithFile:rect:
 
(id) + spriteWithCGImage:key:
 
(id) + spriteWithBatchNode:rect:
 
 Class Methods inherited from CCNode
(id) + node
 

Protected Attributes

CGSize dimensions_
 
CCTextAlignment hAlignment_
 
CCVerticalTextAlignment vAlignment_
 
NSString * fontName_
 
CGFloat fontSize_
 
CCLineBreakMode lineBreakMode_
 
NSString * string_
 
 Protected Attributes inherited from CCSprite
CCTextureAtlastextureAtlas_
 
NSUInteger atlasIndex_
 
CCSpriteBatchNodebatchNode_
 
CGAffineTransform transformToBatch_
 
BOOL dirty_
 
BOOL recursiveDirty_
 
BOOL hasChildren_
 
BOOL shouldBeHidden_
 
ccBlendFunc blendFunc_
 
CCTexture2Dtexture_
 
CGRect rect_
 
BOOL rectRotated_
 
CGPoint offsetPosition_
 
CGPoint unflippedOffsetPositionFromCenter_
 
ccV3F_C4B_T2F_Quad quad_
 
GLubyte opacity_
 
ccColor3B color_
 
ccColor3B colorUnmodified_
 
BOOL opacityModifyRGB_
 
BOOL flipX_
 
BOOL flipY_
 
 Protected Attributes inherited from CCNode
float rotationX_
 
float rotationY_
 
float scaleX_
 
float scaleY_
 
float vertexZ_
 
CGPoint position_
 
float skewX_
 
float skewY_
 
CGPoint anchorPointInPoints_
 
CGPoint anchorPoint_
 
CGSize contentSize_
 
CGAffineTransform transform_
 
CGAffineTransform inverse_
 
CCCameracamera_
 
CCGridBasegrid_
 
NSInteger zOrder_
 
CCArraychildren_
 
CCNodeparent_
 
NSInteger tag_
 
void * userData_
 
id userObject_
 
CCGLProgramshaderProgram_
 
ccGLServerState glServerState_
 
NSUInteger orderOfArrival_
 
CCSchedulerscheduler_
 
CCActionManageractionManager_
 
BOOL isRunning_
 
BOOL isTransformDirty_
 
BOOL isInverseDirty_
 
BOOL visible_
 
BOOL ignoreAnchorPointForPosition_
 
BOOL isReorderChildDirty_
 

Properties

NSString * fontName
 
float fontSize
 
CGSize dimensions
 
CCTextAlignment horizontalAlignment
 
CCVerticalTextAlignment verticalAlignment
 
 Properties inherited from CCSprite
BOOL dirty
 
ccV3F_C4B_T2F_Quad quad
 
NSUInteger atlasIndex
 
CGRect textureRect
 
BOOL textureRectRotated
 
BOOL flipX
 
BOOL flipY
 
GLubyte opacity
 
ccColor3B color
 
CCTextureAtlastextureAtlas
 
CCSpriteBatchNodebatchNode
 
CGPoint offsetPosition
 
ccBlendFunc blendFunc
 
 Properties inherited from CCNode
NSInteger zOrder
 
float vertexZ
 
float skewX
 
float skewY
 
float rotation
 
float rotationX
 
float rotationY
 
float scale
 
float scaleX
 
float scaleY
 
CGPoint position
 
CCCameracamera
 
CCArraychildren
 
CCGridBasegrid
 
BOOL visible
 
CGPoint anchorPoint
 
CGPoint anchorPointInPoints
 
CGSize contentSize
 
BOOL isRunning
 
CCNodeparent
 
BOOL ignoreAnchorPointForPosition
 
NSInteger tag
 
void * userData
 
id userObject
 
CCGLProgramshaderProgram
 
NSUInteger orderOfArrival
 
ccGLServerState glServerState
 
CCActionManageractionManager
 
CCSchedulerscheduler
 

Detailed Description

CCLabel is a subclass of CCTextureNode that knows how to render text labels

All features from CCTextureNode are valid in CCLabel

CCLabel objects are slow. Consider using CCLabelAtlas or CCLabelBMFont instead.

Method Documentation

- (id) initWithString: (NSString *)  string
fontName: (NSString *)  name
fontSize: (CGFloat)  size 

initializes the CCLabelTTF with a font name and font size in points

- (id) initWithString: (NSString *)  string
fontName: (NSString *)  name
fontSize: (CGFloat)  size
dimensions: (CGSize)  dimensions
hAlignment: (CCTextAlignment alignment 

initializes the CCLabelTTF with a font name, horizontal alignment, dimension in points, and font size in points. Default verticalAlignment: kCCVerticalTextAlignmentTop Default lineBreakMode: CCLineBreakModeWordWrap

Since
v1.0
- (id) initWithString: (NSString *)  str
fontName: (NSString *)  name
fontSize: (CGFloat)  size
dimensions: (CGSize)  dimensions
hAlignment: (CCTextAlignment alignment
lineBreakMode: (CCLineBreakMode lineBreakMode 

initializes the CCLabelTTF with a font name, horizontal alignment, dimension in points, line break mode and font size in points. Default verticalAlignment: kCCVerticalTextAlignmentTop

Supported lineBreakModes:

  • iOS: all UILineBreakMode supported modes
  • Mac: Only NSLineBreakByWordWrapping is supported.
    Since
    v1.0
- (id) initWithString: (NSString *)  string
fontName: (NSString *)  name
fontSize: (CGFloat)  size
dimensions: (CGSize)  dimensions
hAlignment: (CCTextAlignment alignment
vAlignment: (CCVerticalTextAlignment vertAlignment 

initializes the CCLabelTTF with a font name, horizontal alignment, vertical alignment, dimension in points and font size in points. Default lineBreakMode: CCLineBreakModeWordWrap

- (id) initWithString: (NSString *)  str
fontName: (NSString *)  name
fontSize: (CGFloat)  size
dimensions: (CGSize)  dimensions
hAlignment: (CCTextAlignment alignment
vAlignment: (CCVerticalTextAlignment vAlignment
lineBreakMode: (CCLineBreakMode lineBreakMode 

initializes the CCLabelTTF with a font name, horizontal alignment, vertical alignment, dimension in points, line break mode and font size in points. Supported lineBreakModes:

  • iOS: all UILineBreakMode supported modes
  • Mac: Only NSLineBreakByWordWrapping is supported.
    Since
    v2.0
+ (id) labelWithString: (NSString *)  string
fontName: (NSString *)  name
fontSize: (CGFloat)  size 

creates a CCLabelTTF with a font name and font size in points

+ (id) labelWithString: (NSString *)  string
fontName: (NSString *)  name
fontSize: (CGFloat)  size
dimensions: (CGSize)  dimensions
hAlignment: (CCTextAlignment alignment 

creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, and font size in points. Supported lineBreakModes:

  • iOS: all UILineBreakMode supported modes
  • Mac: Only NSLineBreakByWordWrapping is supported.
    Since
    v1.0
+ (id) labelWithString: (NSString *)  string
fontName: (NSString *)  name
fontSize: (CGFloat)  size
dimensions: (CGSize)  dimensions
hAlignment: (CCTextAlignment alignment
lineBreakMode: (CCLineBreakMode lineBreakMode 

creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, line break mode, and font size in points. Supported lineBreakModes:

  • iOS: all UILineBreakMode supported modes
  • Mac: Only NSLineBreakByWordWrapping is supported.
    Since
    v1.0
+ (id) labelWithString: (NSString *)  string
fontName: (NSString *)  name
fontSize: (CGFloat)  size
dimensions: (CGSize)  dimensions
hAlignment: (CCTextAlignment alignment
vAlignment: (CCVerticalTextAlignment vertAlignment 

creates a CCLabel from a fontname, alignment, dimension in points and font size in points

+ (id) labelWithString: (NSString *)  string
fontName: (NSString *)  name
fontSize: (CGFloat)  size
dimensions: (CGSize)  dimensions
hAlignment: (CCTextAlignment alignment
vAlignment: (CCVerticalTextAlignment vertAlignment
lineBreakMode: (CCLineBreakMode lineBreakMode 

creates a CCLabelTTF from a fontname, horizontal alignment, vertical alignment, dimension in points, line break mode, and font size in points. Supported lineBreakModes:

  • iOS: all UILineBreakMode supported modes
  • Mac: Only NSLineBreakByWordWrapping is supported.
    Since
    v1.0
- (void) setString: (NSString *)  str

changes the string to render

Warning
Changing the string is as expensive as creating a new CCLabelTTF. To obtain better performance use CCLabelAtlas or CCLabelBMFont.

Reimplemented from <CCLabelProtocol>.

Property Documentation

- (CGSize) dimensions
readwritenonatomicassign

Dimensions of the label in Points

- (NSString*) fontName
readwritenonatomicretain

Font name used in the label

- (float) fontSize
readwritenonatomicassign

Font size of the label

- (CCTextAlignment) horizontalAlignment
readwritenonatomicassign

The alignment of the label

- (CCVerticalTextAlignment) verticalAlignment
readwritenonatomicassign

The vertical alignment of the label


The documentation for this class was generated from the following file: