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

#import <CCLabelBMFont.h>

+ Inheritance diagram for CCLabelBMFont:
+ Collaboration diagram for CCLabelBMFont:

List of all members.

Public Member Functions

(id) - initWithString:fntFile:
(id) - initWithString:fntFile:width:alignment:
(id) - initWithString:fntFile:width:alignment:imageOffset:
(void) - createFontChars
(void) - setWidth:
(void) - setAlignment:

Static Public Member Functions

(void) + purgeCachedData
(id) + labelWithString:fntFile:
(id) + labelWithString:fntFile:width:alignment:
(id) + labelWithString:fntFile:width:alignment:imageOffset:

Protected Attributes

NSString * _string
NSString * _fntFile
NSString * _initialString
float _width
CCTextAlignment _alignment
CCBMFontConfiguration_configuration
GLubyte _displayedOpacity
GLubyte _realOpacity
ccColor3B _displayedColor
ccColor3B _realColor
BOOL _cascadeOpacityEnabled
BOOL _cascadeColorEnabled
BOOL _opacityModifyRGB
CGPoint _imageOffset
CCSprite_reusedChar

Properties

CCTextAlignment alignment
NSString * fntFile
GLubyte opacity
ccColor3B color

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

Member Function 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 [read, assign]

alignment used for the label

- (ccColor3B) color [read, write, assign]

conforms to CCRGBAProtocol protocol

Reimplemented from <CCRGBAProtocol>.

- (NSString*) fntFile [read, write, retain]

fntFile used for the font

- (GLubyte) opacity [read, write, assign]

conforms to CCRGBAProtocol protocol

Reimplemented from <CCRGBAProtocol>.


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