/libs/cocos2d/CCTileMapAtlas.h
C Header | 81 lines | 15 code | 10 blank | 56 comment | 0 complexity | 40aff836c1ce7c41120a7a3f123a0c01 MD5 | raw file
Possible License(s): Apache-2.0
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 "CCAtlasNode.h" 28#import "Support/TGAlib.h" 29 30/** CCTileMapAtlas is a subclass of CCAtlasNode. 31 32 It knows how to render a map based of tiles. 33 The tiles must be in a .PNG format while the map must be a .TGA file. 34 35 For more information regarding the format, please see this post: 36 http://www.cocos2d-iphone.org/archives/27 37 38 All features from CCAtlasNode are valid in CCTileMapAtlas 39 40 IMPORTANT: 41 This class is deprecated. It is maintained for compatibility reasons only. 42 You SHOULD not use this class. 43 Instead, use the newer TMX file format: CCTMXTiledMap 44 */ 45@interface CCTileMapAtlas : CCAtlasNode { 46 47 /// info about the map file 48 tImageTGA *tgaInfo; 49 50 /// x,y to altas dicctionary 51 NSMutableDictionary *posToAtlasIndex; 52 53 /// numbers of tiles to render 54 int itemsToRender; 55} 56 57/** TileMap info */ 58@property (nonatomic,readonly) tImageTGA *tgaInfo; 59 60/** creates a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile. 61 The tile file will be loaded using the TextureMgr. 62 */ 63+(id) tileMapAtlasWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h; 64 65/** initializes a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile. 66 The file will be loaded using the TextureMgr. 67 */ 68-(id) initWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h; 69 70/** returns a tile from position x,y. 71 For the moment only channel R is used 72 */ 73-(ccColor3B) tileAt: (ccGridSize) position; 74 75/** sets a tile at position x,y. 76 For the moment only channel R is used 77 */ 78-(void) setTile:(ccColor3B)tile at:(ccGridSize)position; 79/** dealloc the map from memory */ 80-(void) releaseMap; 81@end