CCLabelBMFont Class Reference
| 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
- (Premium) http://www.71squared.com/glyphdesigner
- (Premium) http://www.bmglyph.com/
- (Free) http://www.n4te.com/hiero/hiero.jnlp
- (Free) http://www.angelcode.com/products/bmfont/
Tasks
Accessing the Text Attributes
Sizing the Label’s Text
Creating a CCLabelBMFont Object
-
+ labelWithString:fntFile: -
+ labelWithString:fntFile:width:alignment: -
+ labelWithString:fntFile:width:alignment:imageOffset:
Initializing a CCLabelBMFont Object
-
– initWithString:fntFile: -
– initWithString:fntFile:width:alignment: -
– initWithString:fntFile:width:alignment:imageOffset:
Memory Management
Properties
alignment
The technique to use for horizontal aligning of the text.
@property (nonatomic, assign, readonly) CCTextAlignment alignmentDeclared In
CCLabelBMFont.hcolor
The color of the text.
@property (nonatomic, strong) CCColor *colorDeclared In
CCLabelBMFont.hClass Methods
labelWithString:fntFile:
Creates and returns a label object using the specified text and font file values.
+ (id)labelWithString:(NSString *)string fntFile:(NSString *)fntFileParameters
- string
Label text.
- fntFile
Label font file.
Return Value
The CCLabelBMFont Object.
Declared In
CCLabelBMFont.hlabelWithString: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)alignmentParameters
- string
Label text.
- fntFile
Label font file.
- width
Label maximum width.
- alignment
Horizontal text alignment.
Return Value
The CCLabelBMFont Object.
Declared In
CCLabelBMFont.hlabelWithString: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)offsetParameters
- 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.hInstance Methods
initWithString:fntFile:
Initializes and returns a label object using the specified text and font file values.
- (id)initWithString:(NSString *)string fntFile:(NSString *)fntFileParameters
- string
Label text.
- fntFile
Label font file.
Return Value
An initialized CCLabelBMFont Object.
Declared In
CCLabelBMFont.hinitWithString: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)alignmentParameters
- string
Label text.
- fntFile
Label font file.
- width
Label maximum width.
- alignment
Horizontal text alignment.
Return Value
An initialized CCLabelBMFont Object.
Declared In
CCLabelBMFont.hinitWithString: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)offsetParameters
- 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.hsetAlignment:
Set the technique to use for horizontal aligning of the text.
- (void)setAlignment:(CCTextAlignment)alignmentParameters
- alignment
Horizontal alignment.
Declared In
CCLabelBMFont.h