Inherits from CCNode : CCResponder : NSObject
Conforms to CCLabelProtocol
CCTextureProtocol
Declared in CCLabelBMFont.h

Overview

CCLabelBMFont displays a bitmap font label. The label is loaded from a fnt-file created with an external editor. Each character in the label is represented by a CCSprite and can be accessed through the children property.

CCLabelBMFont has the flexibility of CCLabel and all the features and performance of CCSprite.

Notes

  • 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.

Supported editors

Properties

alignment

The technique to use for horizontal aligning of the text.

@property (nonatomic, assign, readonly) CCTextAlignment alignment

Declared In

CCLabelBMFont.h

color

The color of the text.

@property (nonatomic, strong) CCColor *color

Declared In

CCLabelBMFont.h

fntFile

The font file of the text.

@property (nonatomic, strong) NSString *fntFile

Declared In

CCLabelBMFont.h

opacity

The opacity of the text.

@property (nonatomic, readwrite) CGFloat opacity

Declared In

CCLabelBMFont.h

Class Methods

labelWithString:fntFile:

Creates and returns a label object using the specified text and font file values.

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

Parameters

string

Label text.

fntFile

Label font file.

Return Value

The CCLabelBMFont Object.

Declared In

CCLabelBMFont.h

labelWithString:fntFile:width:alignment:

Creates and returns a label object using the specified text, font file and alignment values.

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

Parameters

string

Label text.

fntFile

Label font file.

width

Label maximum width.

alignment

Horizontal text alignment.

Return Value

The CCLabelBMFont Object.

Declared In

CCLabelBMFont.h

labelWithString:fntFile:width:alignment:imageOffset:

Creates and returns a label object using the specified text, font file, alignment and image offset values.

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

Parameters

string

Label text.

fntFile

Label font file.

width

Label maximum width.

alignment

Horizontal text alignment.

offset

Glyph offset on the font texture

Return Value

The CCLabelBMFont Object.

Declared In

CCLabelBMFont.h

purgeCachedData

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

+ (void)purgeCachedData

Declared In

CCLabelBMFont.h

Instance Methods

initWithString:fntFile:

Initializes and returns a label object using the specified text and font file values.

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

Parameters

string

Label text.

fntFile

Label font file.

Return Value

An initialized CCLabelBMFont Object.

Declared In

CCLabelBMFont.h

initWithString:fntFile:width:alignment:

Initializes and returns a label object using the specified text, font file and alignment values.

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

Parameters

string

Label text.

fntFile

Label font file.

width

Label maximum width.

alignment

Horizontal text alignment.

Return Value

An initialized CCLabelBMFont Object.

Declared In

CCLabelBMFont.h

initWithString:fntFile:width:alignment:imageOffset:

Initializes and returns a label object using the specified text, font file, alignment and image offset values.

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

Parameters

string

Label text.

fntFile

Label font file.

width

Label maximum width.

alignment

Horizontal text alignment.

offset

Glyph offset on the font texture.

Return Value

An initialized CCLabelBMFont Object.

Declared In

CCLabelBMFont.h

setAlignment:

Set the technique to use for horizontal aligning of the text.

- (void)setAlignment:(CCTextAlignment)alignment

Parameters

alignment

Horizontal alignment.

Declared In

CCLabelBMFont.h

setWidth:

Set the maximum width allowed before a line break will be inserted.

- (void)setWidth:(float)width

Parameters

width

The maximum width.

Declared In

CCLabelBMFont.h