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

#import <CCLabelTTF.h>

+ Inheritance diagram for CCLabelTTF:
+ Collaboration diagram for CCLabelTTF:

List of all members.

Public Member Functions

(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:

Static Public Member Functions

(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:

Protected Attributes

CGSize _dimensions
CCTextAlignment _hAlignment
CCVerticalTextAlignment _vAlignment
NSString * _fontName
CGFloat _fontSize
CCLineBreakMode _lineBreakMode
NSString * _string

Properties

NSString * fontName
float fontSize
CGSize dimensions
CCTextAlignment horizontalAlignment
CCVerticalTextAlignment verticalAlignment

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.


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

Dimensions of the label in Points

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

Font name used in the label

- (float) fontSize [read, write, assign]

Font size of the label

- (CCTextAlignment) horizontalAlignment [read, write, assign]

The alignment of the label

- (CCVerticalTextAlignment) verticalAlignment [read, write, assign]

The vertical alignment of the label


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