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
CCLabelBMFont Class Reference

#import <CCLabelBMFont.h>

Inheritance diagram for CCLabelBMFont:
Collaboration diagram for CCLabelBMFont:

Instance Methods

(id) - initWithString:fntFile:
 
(id) - initWithString:fntFile:width:alignment:
 
(id) - initWithString:fntFile:width:alignment:imageOffset:
 
(void) - createFontChars
 
(void) - setWidth:
 
(void) - setAlignment:
 
 Instance Methods inherited from CCSpriteBatchNode
(id) - initWithTexture:capacity:
 
(id) - initWithFile:capacity:
 
(void) - increaseAtlasCapacity
 
(void) - removeChildAtIndex:cleanup:
 
(void) - removeChild:cleanup:
 
(void) - insertChild:inAtlasAtIndex:
 
(void) - appendChild:
 
(void) - removeSpriteFromAtlas:
 
(NSUInteger) - rebuildIndexInOrder:atlasIndex:
 
(NSUInteger) - atlasIndexForChild:atZ:
 
(void) - reorderBatch:
 
(void) - insertQuadFromSprite:quadIndex:
 
(void) - updateQuadFromSprite:quadIndex:
 
(id) - addSpriteWithoutQuad:z:tag:
 
 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:
 
(BOOL) - DEPRECATED_ATTRIBUTE
 
(void) - setZOrder:
 
 Instance Methods inherited from <CCTextureProtocol>
(CCTexture2D *) - texture
 
(void) - setTexture:
 
 Instance Methods inherited from <CCBlendProtocol>
(void) - setBlendFunc:
 
(ccBlendFunc) - blendFunc
 
 Instance Methods inherited from <CCLabelProtocol>
(void) - setString:
 
(NSString *) - string
 
(void) - setCString:
 
 Instance Methods inherited from <CCRGBAProtocol>
(void) - setColor:
 
(ccColor3B) - color
 
(GLubyte) - opacity
 returns the opacity
 
(void) - setOpacity:
 
(void) - setOpacityModifyRGB:
 
(BOOL) - doesOpacityModifyRGB
 

Class Methods

(void) + purgeCachedData
 
(id) + labelWithString:fntFile:
 
(id) + labelWithString:fntFile:width:alignment:
 
(id) + labelWithString:fntFile:width:alignment:imageOffset:
 
 Class Methods inherited from CCSpriteBatchNode
(id) + batchNodeWithTexture:
 
(id) + batchNodeWithTexture:capacity:
 
(id) + batchNodeWithFile:
 
(id) + batchNodeWithFile:capacity:
 
 Class Methods inherited from CCNode
(id) + node
 

Protected Attributes

NSString * string_
 
NSString * fntFile_
 
NSString * initialString_
 
float width_
 
CCTextAlignment alignment_
 
CCBMFontConfiguration * configuration_
 
GLubyte opacity_
 
ccColor3B color_
 
BOOL opacityModifyRGB_
 
CGPoint imageOffset_
 
CCSprite * reusedChar_
 
 Protected Attributes inherited from CCSpriteBatchNode
CCTextureAtlas * textureAtlas_
 
ccBlendFunc blendFunc_
 
CCArray * descendants_
 
 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_
 
CCCamera * camera_
 
CCGridBase * grid_
 
NSInteger zOrder_
 
CCArray * children_
 
CCNode * parent_
 
NSInteger tag_
 
void * userData_
 
id userObject_
 
CCGLProgram * shaderProgram_
 
ccGLServerState glServerState_
 
NSUInteger orderOfArrival_
 
CCScheduler * scheduler_
 
CCActionManager * actionManager_
 
BOOL isRunning_
 
BOOL isTransformDirty_
 
BOOL isInverseDirty_
 
BOOL visible_
 
BOOL ignoreAnchorPointForPosition_
 
BOOL isReorderChildDirty_
 

Properties

CCTextAlignment alignment
 
NSString * fntFile
 
GLubyte opacity
 
ccColor3B color
 
 Properties inherited from CCSpriteBatchNode
CCTextureAtlas * textureAtlas
 
ccBlendFunc blendFunc
 
CCArray * descendants
 
 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
 
CCCamera * camera
 
CCArray * children
 
CCGridBase * grid
 
BOOL visible
 
CGPoint anchorPoint
 
CGPoint anchorPointInPoints
 
CGSize contentSize
 
BOOL isRunning
 
CCNode * parent
 
BOOL ignoreAnchorPointForPosition
 
NSInteger tag
 
void * userData
 
id userObject
 
CCGLProgram * shaderProgram
 
NSUInteger orderOfArrival
 
ccGLServerState glServerState
 
CCActionManager * actionManager
 
CCScheduler * scheduler
 

Detailed Description

CCLabelBMFont is a subclass of CCSpriteBatchNode

Features:

  • Treats each character like a CCSprite. This means that each individual character can be:
  • rotated
  • scaled
  • translated
  • tinted
  • chage the opacity
  • It can be used as part of a menu item.
  • anchorPoint can be used to align the "label"
  • Supports AngelCode text format

Limitations:

  • All inner characters are using an anchorPoint of (0.5f, 0.5f) and it is not recommend to change it because it might affect the rendering

CCLabelBMFont implements the protocol CCLabelProtocol, like CCLabel and CCLabelAtlas. CCLabelBMFont has the flexibility of CCLabel, the speed of CCLabelAtlas and all the features of CCSprite. If in doubt, use CCLabelBMFont instead of CCLabelAtlas / CCLabel.

Supported editors:

Since
v0.8

Method Documentation

- (void) createFontChars

updates the font chars based on the string to render

- (id) initWithString: (NSString *)  string
fntFile: (NSString *)  fntFile 

init a BMFont label with an initial string and the FNT file

- (id) initWithString: (NSString *)  string
fntFile: (NSString *)  fntFile
width: (float)  width
alignment: (CCTextAlignment)  alignment 

init a BMFont label with an initial string and the FNT file, width, and alignment option

- (id) initWithString: (NSString *)  string
fntFile: (NSString *)  fntFile
width: (float)  width
alignment: (CCTextAlignment)  alignment
imageOffset: (CGPoint)  offset 

init a BMFont label with an initial string and the FNT file, width, alignment option and the offset of where the glyphs start on the .PNG image

+ (id) labelWithString: (NSString *)  string
fntFile: (NSString *)  fntFile 

creates a BMFont label with an initial string and the FNT file.

+ (id) labelWithString: (NSString *)  string
fntFile: (NSString *)  fntFile
width: (float)  width
alignment: (CCTextAlignment)  alignment 

creates a BMFont label with an initial string, the FNT file, width, and alignment option

+ (id) labelWithString: (NSString *)  string
fntFile: (NSString *)  fntFile
width: (float)  width
alignment: (CCTextAlignment)  alignment
imageOffset: (CGPoint)  offset 

creates a BMFont label with an initial string, the FNT file, width, alignment option and the offset of where the glyphs start on the .PNG image

+ (void) purgeCachedData

Purges the cached data. Removes from memory the cached configurations and the atlas name dictionary.

Since
v0.99.3
- (void) setAlignment: (CCTextAlignment)  alignment

set label alignment

- (void) setWidth: (float)  width

set label width

Property Documentation

- (CCTextAlignment) alignment
readnonatomicassign

alignment used for the label

- (ccColor3B) color
readwritenonatomicassign

conforms to CCRGBAProtocol protocol

- (NSString*) fntFile
readwritenonatomicretain

fntFile used for the font

- (GLubyte) opacity
readwritenonatomicassign

conforms to CCRGBAProtocol protocol


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