00001 #ifndef LIBWIISPRITE_TILEDLAYER
00002 #define LIBWIISPRITE_TILEDLAYER
00003
00004 #include <stdlib.h>
00005 #include <gccore.h>
00006 #include "image.h"
00007 #include "layer.h"
00008
00010 namespace wsp{
00012 class TiledLayer : public Layer{
00013 public:
00018 TiledLayer(s32 columns, s32 rows, u32 ani);
00020 virtual ~TiledLayer();
00021
00022
00026 void SetStaticTileset(Image* image, u32 tileWidth, u32 tileHeight);
00031 void SetCell(u32 col, u32 row, s32 tileIndex);
00032
00039 void FillCells(u32 col, u32 row, u32 numCols, u32 numRows, s32 tileIndex);
00040
00043 s32 CreateAnimatedTile();
00047 u32 GetAnimatedTile(s32 animatedTileIndex) const;
00051 void SetAnimatedTile(s32 animatedTileIndex, u32 staticTileIndex);
00052
00057 s32 GetCell(u32 col, u32 row) const;
00060 u32 GetCellWidth() const;
00063 u32 GetCellHeight() const;
00066 u32 GetColumns() const;
00069 u32 GetRows() const;
00072 const Image* GetImage() const;
00073
00075 void Draw(f32 offsetX = 0, f32 offsetY = 0) const;
00076 protected:
00077 private:
00078 s32* _data; u32 _columns, _rows;
00079 u32 _tileWidth, _tileHeight;
00080 u32* _animations; u32 _aniSize, _aniBoundary;
00081 Image* _image; u32 _tiles;
00082 };
00083 };
00084
00085 #endif