PageRenderTime 21ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/libs/cocos2d/CCAtlasNode.h

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