00001 #ifndef ANIMATION_SURFACE_H 00002 #define ANIMATION_SURFACE_H 00003 00013 #include "drawSurface.h" 00014 00015 00022 class AnimationSurface : public SurfaceInterface { 00023 public: 00027 class CellInformation { 00028 CellInformation(void); 00029 00030 public: 00038 CellInformation(int index, unsigned long ticks, char align = 0) 00039 : index(index), ticks(ticks), align(align) {} 00040 ~CellInformation(void) {} 00041 int index; 00042 unsigned long ticks; 00043 char align; 00045 VXV::Grid offset; 00046 }; 00047 00048 private: 00049 std::vector<DrawSurface*> cells; 00050 std::vector<CellInformation> cell_info; 00051 unsigned long ticks_msec; 00052 unsigned long cycle; 00053 void sizeUpdate(DrawSurface* surface); 00054 00055 public: 00056 AnimationSurface(void); 00057 ~AnimationSurface(void); 00058 bool draw(const VXV::Rect& size, 00059 const VXV::Grid& pos, unsigned long ticks); 00060 00071 int addCell(const char* bmpFile, bool transparent = false); 00072 00081 int addCell(SDL_Surface* sdlSurface, bool transparent = false); 00082 00090 void addCellInformation(const CellInformation& info); 00091 00101 void setTicksMsec(unsigned long msec); 00102 }; 00103 00104 #endif /* !ANIMATION_SURFACE_H */ 00105