diff options
Diffstat (limited to 'libs/cocos2d/CCTileMapAtlas.h')
-rwxr-xr-x | libs/cocos2d/CCTileMapAtlas.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/libs/cocos2d/CCTileMapAtlas.h b/libs/cocos2d/CCTileMapAtlas.h new file mode 100755 index 0000000..102ae46 --- /dev/null +++ b/libs/cocos2d/CCTileMapAtlas.h | |||
@@ -0,0 +1,83 @@ | |||
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 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
8 | * of this software and associated documentation files (the "Software"), to deal | ||
9 | * in the Software without restriction, including without limitation the rights | ||
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
11 | * copies of the Software, and to permit persons to whom the Software is | ||
12 | * furnished to do so, subject to the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice shall be included in | ||
15 | * all copies or substantial portions of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
23 | * THE SOFTWARE. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #import "CCTextureAtlas.h" | ||
28 | #import "CCAtlasNode.h" | ||
29 | #import "Support/TGAlib.h" | ||
30 | |||
31 | /** CCTileMapAtlas is a subclass of CCAtlasNode. | ||
32 | |||
33 | It knows how to render a map based of tiles. | ||
34 | The tiles must be in a .PNG format while the map must be a .TGA file. | ||
35 | |||
36 | For more information regarding the format, please see this post: | ||
37 | http://www.cocos2d-iphone.org/archives/27 | ||
38 | |||
39 | All features from CCAtlasNode are valid in CCTileMapAtlas | ||
40 | |||
41 | IMPORTANT: | ||
42 | This class is deprecated. It is maintained for compatibility reasons only. | ||
43 | You SHOULD not use this class. | ||
44 | Instead, use the newer TMX file format: CCTMXTiledMap | ||
45 | */ | ||
46 | @interface CCTileMapAtlas : CCAtlasNode | ||
47 | { | ||
48 | |||
49 | /// info about the map file | ||
50 | tImageTGA *tgaInfo; | ||
51 | |||
52 | /// x,y to altas dicctionary | ||
53 | NSMutableDictionary *posToAtlasIndex; | ||
54 | |||
55 | /// numbers of tiles to render | ||
56 | int itemsToRender; | ||
57 | } | ||
58 | |||
59 | /** TileMap info */ | ||
60 | @property (nonatomic,readonly) tImageTGA *tgaInfo; | ||
61 | |||
62 | /** creates a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile in points. | ||
63 | The tile file will be loaded using the TextureMgr. | ||
64 | */ | ||
65 | +(id) tileMapAtlasWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h; | ||
66 | |||
67 | /** initializes a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile in points. | ||
68 | The file will be loaded using the TextureMgr. | ||
69 | */ | ||
70 | -(id) initWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h; | ||
71 | |||
72 | /** returns a tile from position x,y. | ||
73 | For the moment only channel R is used | ||
74 | */ | ||
75 | -(ccColor3B) tileAt: (ccGridSize) position; | ||
76 | |||
77 | /** sets a tile at position x,y. | ||
78 | For the moment only channel R is used | ||
79 | */ | ||
80 | -(void) setTile:(ccColor3B)tile at:(ccGridSize)position; | ||
81 | /** dealloc the map from memory */ | ||
82 | -(void) releaseMap; | ||
83 | @end | ||