diff options
Diffstat (limited to 'libs/cocos2d/CCLabelTTF.h')
| -rwxr-xr-x | libs/cocos2d/CCLabelTTF.h | 78 |
1 files changed, 78 insertions, 0 deletions
| diff --git a/libs/cocos2d/CCLabelTTF.h b/libs/cocos2d/CCLabelTTF.h new file mode 100755 index 0000000..8e48ce1 --- /dev/null +++ b/libs/cocos2d/CCLabelTTF.h | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* | ||
| 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org | ||
| 3 | * | ||
| 4 | * Copyright (c) 2008-2010 Ricardo Quesada | ||
| 5 | * Copyright (c) 2011 Zynga Inc. | ||
| 6 | * | ||
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 8 | * of this software and associated documentation files (the "Software"), to deal | ||
| 9 | * in the Software without restriction, including without limitation the rights | ||
| 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 11 | * copies of the Software, and to permit persons to whom the Software is | ||
| 12 | * furnished to do so, subject to the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice shall be included in | ||
| 15 | * all copies or substantial portions of the Software. | ||
| 16 | * | ||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 23 | * THE SOFTWARE. | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | |||
| 28 | #import "CCTexture2D.h" | ||
| 29 | #import "CCSprite.h" | ||
| 30 | #import "Platforms/CCNS.h" | ||
| 31 | |||
| 32 | |||
| 33 | /** CCLabel is a subclass of CCTextureNode that knows how to render text labels | ||
| 34 | * | ||
| 35 | * All features from CCTextureNode are valid in CCLabel | ||
| 36 | * | ||
| 37 | * CCLabel objects are slow. Consider using CCLabelAtlas or CCLabelBMFont instead. | ||
| 38 | */ | ||
| 39 | |||
| 40 | @interface CCLabelTTF : CCSprite <CCLabelProtocol> | ||
| 41 | { | ||
| 42 | CGSize dimensions_; | ||
| 43 | CCTextAlignment alignment_; | ||
| 44 | NSString * fontName_; | ||
| 45 | CGFloat fontSize_; | ||
| 46 | CCLineBreakMode lineBreakMode_; | ||
| 47 | NSString *string_; | ||
| 48 | } | ||
| 49 | |||
| 50 | /** creates a CCLabel from a fontname, alignment, dimension in points, line break mode, and font size in points. | ||
| 51 | Supported lineBreakModes: | ||
| 52 | - iOS: all UILineBreakMode supported modes | ||
| 53 | - Mac: Only NSLineBreakByWordWrapping is supported. | ||
| 54 | @since v1.0 | ||
| 55 | */ | ||
| 56 | + (id) labelWithString:(NSString*)string dimensions:(CGSize)dimensions alignment:(CCTextAlignment)alignment lineBreakMode:(CCLineBreakMode)lineBreakMode fontName:(NSString*)name fontSize:(CGFloat)size; | ||
| 57 | /** creates a CCLabel from a fontname, alignment, dimension in points and font size in points*/ | ||
| 58 | + (id) labelWithString:(NSString*)string dimensions:(CGSize)dimensions alignment:(CCTextAlignment)alignment fontName:(NSString*)name fontSize:(CGFloat)size; | ||
| 59 | /** creates a CCLabel from a fontname and font size in points*/ | ||
| 60 | + (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size; | ||
| 61 | /** initializes the CCLabel with a font name, alignment, dimension in points, line brea mode and font size in points. | ||
| 62 | Supported lineBreakModes: | ||
| 63 | - iOS: all UILineBreakMode supported modes | ||
| 64 | - Mac: Only NSLineBreakByWordWrapping is supported. | ||
| 65 | @since v1.0 | ||
| 66 | */ | ||
| 67 | - (id) initWithString:(NSString*)str dimensions:(CGSize)dimensions alignment:(CCTextAlignment)alignment lineBreakMode:(CCLineBreakMode)lineBreakMode fontName:(NSString*)name fontSize:(CGFloat)size; | ||
| 68 | /** initializes the CCLabel with a font name, alignment, dimension in points and font size in points */ | ||
| 69 | - (id) initWithString:(NSString*)string dimensions:(CGSize)dimensions alignment:(CCTextAlignment)alignment fontName:(NSString*)name fontSize:(CGFloat)size; | ||
| 70 | /** initializes the CCLabel with a font name and font size in points */ | ||
| 71 | - (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size; | ||
| 72 | |||
| 73 | /** changes the string to render | ||
| 74 | * @warning Changing the string is as expensive as creating a new CCLabel. To obtain better performance use CCLabelAtlas | ||
| 75 | */ | ||
| 76 | - (void) setString:(NSString*)str; | ||
| 77 | |||
| 78 | @end | ||
