/libs/cocos2d/CCTileMapAtlas.h

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