00001
00002
00003
00004
00005 #ifndef LIBWIISPRITE_TILEDLAYER
00006 #define LIBWIISPRITE_TILEDLAYER
00007
00008 #include <stdlib.h>
00009 #include <gccore.h>
00010 #include "image.h"
00011 #include "layer.h"
00012
00014 namespace wsp{
00016 class TiledLayer : public Layer{
00017 public:
00022 TiledLayer(s32 columns, s32 rows, u32 ani);
00024 virtual ~TiledLayer();
00025
00026
00030 void SetStaticTileset(Image* image, u32 tileWidth, u32 tileHeight);
00035 void SetCell(u32 col, u32 row, s32 tileIndex);
00036
00043 void FillCells(u32 col, u32 row, u32 numCols, u32 numRows, s32 tileIndex);
00044
00048 s32 CreateAnimatedTile();
00053 u32 GetAnimatedTile(s32 animatedTileIndex) const;
00058 void SetAnimatedTile(s32 animatedTileIndex, u32 staticTileIndex);
00059
00064 s32 GetCell(u32 col, u32 row) const;
00067 u32 GetCellWidth() const;
00070 u32 GetCellHeight() const;
00073 u32 GetColumns() const;
00076 u32 GetRows() const;
00079 const Image* GetImage() const;
00080
00083 void SetTransparency(u8 alpha);
00086 u8 GetTransparency() const;
00087
00089 void Draw(f32 offsetX = 0, f32 offsetY = 0) const;
00090 protected:
00091 private:
00092 s32* _data; u32 _columns, _rows;
00093 u32 _tileWidth, _tileHeight;
00094 u32* _animations; u32 _aniSize, _aniBoundary;
00095 Image* _image; u32 _tiles;
00096 u8 _alpha;
00097 };
00098 };
00121 #endif