diff options
Diffstat (limited to 'libs/cocos2d/CCAtlasNode.h')
-rwxr-xr-x | libs/cocos2d/CCAtlasNode.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/libs/cocos2d/CCAtlasNode.h b/libs/cocos2d/CCAtlasNode.h new file mode 100755 index 0000000..43e57c2 --- /dev/null +++ b/libs/cocos2d/CCAtlasNode.h | |||
@@ -0,0 +1,93 @@ | |||
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 | * | ||
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
9 | * of this software and associated documentation files (the "Software"), to deal | ||
10 | * in the Software without restriction, including without limitation the rights | ||
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
12 | * copies of the Software, and to permit persons to whom the Software is | ||
13 | * furnished to do so, subject to the following conditions: | ||
14 | * | ||
15 | * The above copyright notice and this permission notice shall be included in | ||
16 | * all copies or substantial portions of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
24 | * THE SOFTWARE. | ||
25 | */ | ||
26 | |||
27 | |||
28 | #import "CCTextureAtlas.h" | ||
29 | #import "CCNode.h" | ||
30 | #import "CCProtocols.h" | ||
31 | |||
32 | /** CCAtlasNode is a subclass of CCNode that implements the CCRGBAProtocol and | ||
33 | CCTextureProtocol protocol | ||
34 | |||
35 | It knows how to render a TextureAtlas object. | ||
36 | If you are going to render a TextureAtlas consider subclassing CCAtlasNode (or a subclass of CCAtlasNode) | ||
37 | |||
38 | All features from CCNode are valid, plus the following features: | ||
39 | - opacity and RGB colors | ||
40 | */ | ||
41 | @interface CCAtlasNode : CCNode <CCRGBAProtocol, CCTextureProtocol> | ||
42 | { | ||
43 | // texture atlas | ||
44 | CCTextureAtlas *textureAtlas_; | ||
45 | |||
46 | // chars per row | ||
47 | NSUInteger itemsPerRow_; | ||
48 | // chars per column | ||
49 | NSUInteger itemsPerColumn_; | ||
50 | |||
51 | // width of each char | ||
52 | NSUInteger itemWidth_; | ||
53 | // height of each char | ||
54 | NSUInteger itemHeight_; | ||
55 | |||
56 | // quads to draw | ||
57 | NSUInteger quadsToDraw_; | ||
58 | |||
59 | // blend function | ||
60 | ccBlendFunc blendFunc_; | ||
61 | |||
62 | // texture RGBA. | ||
63 | GLubyte opacity_; | ||
64 | ccColor3B color_; | ||
65 | ccColor3B colorUnmodified_; | ||
66 | BOOL opacityModifyRGB_; | ||
67 | } | ||
68 | |||
69 | /** conforms to CCTextureProtocol protocol */ | ||
70 | @property (nonatomic,readwrite,retain) CCTextureAtlas *textureAtlas; | ||
71 | |||
72 | /** conforms to CCTextureProtocol protocol */ | ||
73 | @property (nonatomic,readwrite) ccBlendFunc blendFunc; | ||
74 | |||
75 | /** conforms to CCRGBAProtocol protocol */ | ||
76 | @property (nonatomic,readwrite) GLubyte opacity; | ||
77 | /** conforms to CCRGBAProtocol protocol */ | ||
78 | @property (nonatomic,readwrite) ccColor3B color; | ||
79 | |||
80 | /** how many quads to draw */ | ||
81 | @property (readwrite) NSUInteger quadsToDraw; | ||
82 | |||
83 | /** creates a CCAtlasNode with an Atlas file the width and height of each item measured in points and the quantity of items to render*/ | ||
84 | +(id) atlasWithTileFile:(NSString*)tile tileWidth:(NSUInteger)w tileHeight:(NSUInteger)h itemsToRender: (NSUInteger) c; | ||
85 | |||
86 | /** initializes an CCAtlasNode with an Atlas file the width and height of each item measured in points and the quantity of items to render*/ | ||
87 | -(id) initWithTileFile:(NSString*)tile tileWidth:(NSUInteger)w tileHeight:(NSUInteger)h itemsToRender: (NSUInteger) c; | ||
88 | |||
89 | /** updates the Atlas (indexed vertex array). | ||
90 | * Shall be overriden in subclasses | ||
91 | */ | ||
92 | -(void) updateAtlasValues; | ||
93 | @end | ||