diff options
Diffstat (limited to 'libs/cocos2d/CCLabelAtlas.h')
-rwxr-xr-x | libs/cocos2d/CCLabelAtlas.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/libs/cocos2d/CCLabelAtlas.h b/libs/cocos2d/CCLabelAtlas.h new file mode 100755 index 0000000..f7781a4 --- /dev/null +++ b/libs/cocos2d/CCLabelAtlas.h | |||
@@ -0,0 +1,62 @@ | |||
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 "CCAtlasNode.h" | ||
29 | #import "CCTextureAtlas.h" | ||
30 | |||
31 | /** CCLabelAtlas is a subclass of CCAtlasNode. | ||
32 | |||
33 | It can be as a replacement of CCLabel since it is MUCH faster. | ||
34 | |||
35 | CCLabelAtlas versus CCLabel: | ||
36 | - CCLabelAtlas is MUCH faster than CCLabel | ||
37 | - CCLabelAtlas "characters" have a fixed height and width | ||
38 | - CCLabelAtlas "characters" can be anything you want since they are taken from an image file | ||
39 | |||
40 | A more flexible class is CCLabelBMFont. It supports variable width characters and it also has a nice editor. | ||
41 | */ | ||
42 | @interface CCLabelAtlas : CCAtlasNode <CCLabelProtocol> | ||
43 | { | ||
44 | // string to render | ||
45 | NSString *string_; | ||
46 | |||
47 | // the first char in the charmap | ||
48 | unsigned char mapStartChar_; | ||
49 | } | ||
50 | |||
51 | |||
52 | /** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element in points and the starting char of the atlas */ | ||
53 | +(id) labelWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(NSUInteger)w itemHeight:(NSUInteger)h startCharMap:(unsigned char)c; | ||
54 | |||
55 | /** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element in points and the starting char of the atlas. | ||
56 | @deprecated Will be removed in 1.0.1. Use "labelWithString:" instead | ||
57 | */ | ||
58 | +(id) labelAtlasWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(NSUInteger)w itemHeight:(NSUInteger)h startCharMap:(unsigned char)c DEPRECATED_ATTRIBUTE; | ||
59 | |||
60 | /** initializes the CCLabelAtlas with a string, a char map file(the atlas), the width and height in points of each element and the starting char of the atlas */ | ||
61 | -(id) initWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(NSUInteger)w itemHeight:(NSUInteger)h startCharMap:(unsigned char)c; | ||
62 | @end | ||