123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #ifndef __CCTILE_MAP_ATLAS__
- #define __CCTILE_MAP_ATLAS__
- #include "2d/CCAtlasNode.h"
- #include "base/CCValue.h"
- NS_CC_BEGIN
- struct sImageTGA;
- class CC_DLL TileMapAtlas : public AtlasNode
- {
- public:
-
- static TileMapAtlas * create(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight);
-
- TileMapAtlas();
-
- virtual ~TileMapAtlas();
-
-
- bool initWithTileFile(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight);
-
- Color3B getTileAt(const Vec2& position) const;
-
- CC_DEPRECATED_ATTRIBUTE Color3B tileAt(const Vec2& position) const { return getTileAt(position); };
-
- void setTile(const Color3B& tile, const Vec2& position);
-
- void releaseMap();
-
-
- struct sImageTGA* getTGAInfo() const { return _TGAInfo; }
-
- void setTGAInfo(struct sImageTGA* TGAInfo) { _TGAInfo = TGAInfo; }
- protected:
- void loadTGAfile(const std::string& file);
- void calculateItemsToRender();
- void updateAtlasValueAt(const Vec2& pos, const Color3B& value, int index);
- void updateAtlasValues();
-
- ValueMap _posToAtlasIndex;
-
- int _itemsToRender;
-
- struct sImageTGA* _TGAInfo;
- };
- NS_CC_END
- #endif
|