|
cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
|
00001 /* 00002 * cocos2d for iPhone: http://www.cocos2d-iphone.org 00003 * 00004 * Copyright (c) 2008-2010 Ricardo Quesada 00005 * Copyright (c) 2011 Zynga Inc. 00006 * 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining a copy 00009 * of this software and associated documentation files (the "Software"), to deal 00010 * in the Software without restriction, including without limitation the rights 00011 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00012 * copies of the Software, and to permit persons to whom the Software is 00013 * furnished to do so, subject to the following conditions: 00014 * 00015 * The above copyright notice and this permission notice shall be included in 00016 * all copies or substantial portions of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00021 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00022 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00023 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00024 * THE SOFTWARE. 00025 */ 00026 00027 00028 #import "CCTextureAtlas.h" 00029 #import "CCNode.h" 00030 #import "CCProtocols.h" 00031 00041 @interface CCAtlasNode : CCNode <CCRGBAProtocol, CCTextureProtocol> 00042 { 00043 // texture atlas 00044 CCTextureAtlas *textureAtlas_; 00045 00046 // chars per row 00047 NSUInteger itemsPerRow_; 00048 // chars per column 00049 NSUInteger itemsPerColumn_; 00050 00051 // width of each char 00052 NSUInteger itemWidth_; 00053 // height of each char 00054 NSUInteger itemHeight_; 00055 00056 // quads to draw 00057 NSUInteger quadsToDraw_; 00058 00059 // blend function 00060 ccBlendFunc blendFunc_; 00061 00062 // texture RGBA. 00063 GLubyte opacity_; 00064 ccColor3B color_; 00065 ccColor3B colorUnmodified_; 00066 BOOL opacityModifyRGB_; 00067 } 00068 00070 @property (nonatomic,readwrite,retain) CCTextureAtlas *textureAtlas; 00071 00073 @property (nonatomic,readwrite) ccBlendFunc blendFunc; 00074 00076 @property (nonatomic,readwrite) GLubyte opacity; 00078 @property (nonatomic,readwrite) ccColor3B color; 00079 00081 @property (readwrite) NSUInteger quadsToDraw; 00082 00084 +(id) atlasWithTileFile:(NSString*)tile tileWidth:(NSUInteger)w tileHeight:(NSUInteger)h itemsToRender: (NSUInteger) c; 00085 00087 -(id) initWithTileFile:(NSString*)tile tileWidth:(NSUInteger)w tileHeight:(NSUInteger)h itemsToRender: (NSUInteger) c; 00088 00092 -(void) updateAtlasValues; 00093 @end