00001 #ifndef __ANIMATIONINFO_H 00002 #define __ANIMATIONINFO_H 00003 00004 /* flags */ 00005 00006 /* 00007 COLORKEY_PIXEL_TOPLEFT is set when the animation has transparency 00008 and the transparent pixel color is the color of the topleft image 00009 pixel. For example, if the topleft pixel's color is 0x0000FF (blue), 00010 than all 0x0000FF (blue) pixels in the image are interpreted as 00011 transparent. 00012 00013 MASK_PIXEL_COLORKEY is set when a mask should be constructed for the 00014 animation, and the mask should discriminate based on the colorkey. 00015 For example, if the colorkey is 0x0000FF (blue), than the mask should 00016 have OFF (0) in the mask for every 0x0000FF (blue) pixel, and ON (1) 00017 for every other pixel. 00018 */ 00019 00020 #define COLORKEY_NONE 0 00021 #define COLORKEY_BLACK 1 00022 #define COLORKEY_WHITE 2 00023 #define COLORKEY_RED 3 00024 #define COLORKEY_GREEN 4 00025 #define COLORKEY_BLUE 5 00026 #define COLORKEY_PIXEL_TOPLEFT 6 00027 #define COLORKEY_PIXEL_TOPRIGHT 7 00028 #define COLORKEY_PIXEL_BOTTOMRIGHT 8 00029 #define COLORKEY_PIXEL_BOTTOMLEFT 9 00030 00031 #define MASK_PIXEL_COLORKEY 1 00032 00033 /* 00034 Provides identification and 00035 content information for 00036 tile & object animations. 00037 */ 00038 00039 class AnimationInfo 00040 { 00041 private: 00042 string title; 00043 AnimationInfo* flipsrc; 00044 int colorkey; 00045 int flags; 00046 int nframes; 00047 string *filenames; 00048 int *durations; 00049 SDL_Surface **frames; 00050 Mask **masks; 00051 public: 00052 AnimationInfo( ifstream *f, Display* ); 00053 ~AnimationInfo(); 00054 int TotalDuration(); 00055 void Flip(); 00056 void CreateMasks(); 00057 SDL_Surface *GetFrame(int f); 00058 int GetDuration(int f); 00059 int GetNFrames(); 00060 Mask *GetMask(int f); 00061 }; 00062 00063 #endif // __ANIMATIONINFO_H