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
00044 s32 CreateAnimatedTile();
00049 u32 GetAnimatedTile(s32 animatedTileIndex) const;
00054 void SetAnimatedTile(s32 animatedTileIndex, u32 staticTileIndex);
00055
00060 s32 GetCell(u32 col, u32 row) const;
00063 u32 GetCellWidth() const;
00066 u32 GetCellHeight() const;
00069 u32 GetColumns() const;
00072 u32 GetRows() const;
00075 const Image* GetImage() const;
00076
00079 void SetTransparency(u8 alpha);
00082 u8 GetTransparency() const;
00083
00085 void Draw(f32 offsetX = 0, f32 offsetY = 0) const;
00086 protected:
00087 private:
00088 s32* _data; u32 _columns, _rows;
00089 u32 _tileWidth, _tileHeight;
00090 u32* _animations; u32 _aniSize, _aniBoundary;
00091 Image* _image; u32 _tiles;
00092 u8 _alpha;
00093 };
00094 };
00117 #endif