Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

animation.h

00001 #ifndef DEF_ANIMATION_H 00002 #define DEF_ANIMATION_H 1 00003 00004 class EmptyAnimation { 00005 public: 00006 EmptyAnimation(EmptyAnimationPtr* afallback=NULL); 00007 virtual ~EmptyAnimation() { } 00008 virtual void setBasePos(SDL_Rect*); 00009 virtual void unsetBasePos(); 00010 virtual void runAnim(); 00011 virtual bool updateAnim(Uint16); 00012 virtual Frame getFrame() const; 00013 virtual SDL_Rect getDrawPos() const; 00014 virtual SDL_Rect getFrameDim() const; 00015 virtual Frame getBaseFrame() const; 00016 virtual bool isValid() const; 00017 virtual bool isRunning() const; 00018 virtual bool isImage() const; 00019 virtual bool isFixed() const; 00020 virtual void setFallBack(EmptyAnimationPtr* newfallback=NULL); 00021 protected: 00022 Frame base_frame; 00023 private: 00024 EmptyAnimationPtr* fallback; 00025 }; 00026 00030 class Animation : public EmptyAnimation { 00031 public: 00042 Animation(const Image& abase_image, 00043 Uint16 aframes=1, 00044 BasePointType abp_type=BP_MD, 00045 Uint16 aanimation_type=ATYPE_LOOP, 00046 double afps=0, 00047 Uint16 astart_pos=0, 00048 AllignType aallign_type=AT_MD); 00049 Animation(); 00050 virtual ~Animation(); 00052 virtual void setBasePos(SDL_Rect* abase_pos) { 00053 base_pos=abase_pos; 00054 checkAnim(); 00055 } 00057 virtual void unsetBasePos() { 00058 base_pos=NULL; 00059 } 00061 virtual void runAnim(); 00064 virtual bool updateAnim(Uint16 dt); 00066 virtual Frame getFrame() const; 00069 virtual SDL_Rect getDrawPos() const; 00071 virtual SDL_Rect getFrameDim() const; 00073 virtual Frame getBaseFrame() const; 00075 virtual bool isValid() const { 00076 return is_valid; 00077 } 00079 virtual bool isRunning() const { 00080 return is_running; 00081 } 00083 virtual bool isImage() const { 00084 return is_image; 00085 } 00087 virtual bool isFixed() const { 00088 return is_fixed; 00089 } 00090 virtual void setFallBack(EmptyAnimationPtr*) { } 00091 protected: 00093 void setShift(); 00095 bool stopAnim(); 00097 bool checkAnim(); 00098 protected: 00100 Image base_image; 00102 Uint16 frames; 00111 BasePointType bp_type; 00116 Uint16 animation_type; 00118 double fps; 00120 Uint16 start_pos; 00130 AllignType allign_type; 00131 00132 /* calculated (checkAnim()) or given values */ 00134 SDL_Rect* base_pos; 00136 Sint16 shift_x; 00137 Sint16 shift_y; 00139 Uint32 duration; 00141 Uint16 base_frame_pos; 00143 Uint16 end_pos; 00145 bool is_image; 00147 bool is_valid; 00149 bool is_fixed; 00150 00151 /* temporary values */ 00153 bool is_running; 00155 bool forward; 00157 Uint16 cur_frame_num; 00159 Uint32 cur_time; 00160 }; 00161 00162 #endif

Generated on Sun Feb 5 13:02:35 2006 for Lost Penguins by doxygen 1.3.8