cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
/Users/rquesada/progs/cocos2d-iphone/cocos2d/CCTMXLayer.h
00001 /*
00002  * cocos2d for iPhone: http://www.cocos2d-iphone.org
00003  *
00004  * Copyright (c) 2009-2010 Ricardo Quesada
00005  * Copyright (c) 2011 Zynga Inc.
00006  * 
00007  * Permission is hereby granted, free of charge, to any person obtaining a copy
00008  * of this software and associated documentation files (the "Software"), to deal
00009  * in the Software without restriction, including without limitation the rights
00010  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011  * copies of the Software, and to permit persons to whom the Software is
00012  * furnished to do so, subject to the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice shall be included in
00015  * all copies or substantial portions of the Software.
00016  * 
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00022  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00023  * THE SOFTWARE.
00024  *
00025  *
00026  * TMX Tiled Map support:
00027  * http://www.mapeditor.org
00028  *
00029  */
00030 
00031 
00032 #import "CCAtlasNode.h"
00033 #import "CCSpriteBatchNode.h"
00034 
00035 
00036 @class CCTMXMapInfo;
00037 @class CCTMXLayerInfo;
00038 @class CCTMXTilesetInfo;
00039 
00065 @interface CCTMXLayer : CCSpriteBatchNode
00066 {
00067         CCTMXTilesetInfo        *tileset_;
00068         NSString                        *layerName_;
00069         CGSize                          layerSize_;
00070         CGSize                          mapTileSize_;
00071         uint32_t                        *tiles_;                        // GID are 32 bit
00072         NSUInteger                      layerOrientation_;
00073         NSMutableArray          *properties_;
00074         
00075         unsigned char           opacity_; // TMX Layer supports opacity
00076         
00077         NSUInteger                      minGID_;
00078         NSUInteger                      maxGID_;
00079         
00080         // Only used when vertexZ is used
00081         NSInteger                       vertexZvalue_;
00082         BOOL                            useAutomaticVertexZ_;
00083         float                           alphaFuncValue_;
00084         
00085         // used for optimization
00086         CCSprite                *reusedTile_;
00087         ccCArray                *atlasIndexArray_;
00088 }
00090 @property (nonatomic,readwrite,retain) NSString *layerName;
00092 @property (nonatomic,readwrite) CGSize layerSize;
00094 @property (nonatomic,readwrite) CGSize mapTileSize;
00096 @property (nonatomic,readwrite) uint32_t *tiles;
00098 @property (nonatomic,readwrite,retain) CCTMXTilesetInfo *tileset;
00100 @property (nonatomic,readwrite) NSUInteger layerOrientation;
00102 @property (nonatomic,readwrite,retain) NSMutableArray *properties;
00103 
00105 +(id) layerWithTilesetInfo:(CCTMXTilesetInfo*)tilesetInfo layerInfo:(CCTMXLayerInfo*)layerInfo mapInfo:(CCTMXMapInfo*)mapInfo;
00107 -(id) initWithTilesetInfo:(CCTMXTilesetInfo*)tilesetInfo layerInfo:(CCTMXLayerInfo*)layerInfo mapInfo:(CCTMXMapInfo*)mapInfo;
00108 
00113 -(void) releaseMap;
00114 
00122 -(CCSprite*) tileAt:(CGPoint)tileCoordinate;
00123 
00128 -(uint32_t) tileGIDAt:(CGPoint)tileCoordinate;
00129 
00134 -(void) setTileGID:(uint32_t)gid at:(CGPoint)tileCoordinate;
00135 
00137 -(void) removeTileAt:(CGPoint)tileCoordinate;
00138 
00140 -(CGPoint) positionAt:(CGPoint)tileCoordinate;
00141 
00143 -(id) propertyNamed:(NSString *)propertyName;
00144 
00146 -(void) setupTiles;
00147 
00151 -(void) addChild: (CCNode*)node z:(NSInteger)z tag:(NSInteger)tag;
00152 @end
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone API Reference - Generated using Doxygen 1.7.4