00001 #ifndef HEADER_ANIM_H
00002 #define HEADER_ANIM_H
00003
00004 class Path;
00005 class ResImagePack;
00006
00007 #include "ViewEffect.h"
00008 #include "NoCopy.h"
00009 #include "V2.h"
00010
00011 #include "SDL.h"
00012
00013
00014
00015
00016 class Anim : public NoCopy {
00017 public:
00018 enum eSide {
00019 SIDE_LEFT = 0,
00020 SIDE_RIGHT = 1
00021 };
00022 private:
00023 ViewEffect *m_effect;
00024 V2 m_viewShift;
00025 ResImagePack *m_animPack[2];
00026 std::string m_animName;
00027 int m_animPhase;
00028 bool m_run;
00029 std::string m_specialAnimName;
00030 int m_specialAnimPhase;
00031 std::string m_usedPath;
00032 private:
00033 void blit(SDL_Surface *screen, SDL_Surface *surface, int x, int y);
00034 public:
00035 Anim();
00036 virtual ~Anim();
00037
00038 void drawAt(SDL_Surface *screen, int x, int y, eSide side);
00039
00040 void addAnim(const std::string &name, const Path &picture,
00041 eSide side=SIDE_LEFT);
00042 void runAnim(const std::string &name, int start_phase=0);
00043 void setAnim(const std::string &name, int phase);
00044 void useSpecialAnim(const std::string &name, int phase);
00045
00046 bool isDisintegrated() const { return m_effect->isDisintegrated(); }
00047 bool isInvisible() const { return m_effect->isInvisible(); }
00048 void changeEffect(ViewEffect *new_effect);
00049 void setViewShift(const V2 &shift) { m_viewShift = shift; }
00050 V2 getViewShift() const { return m_viewShift; };
00051
00052 int countAnimPhases(const std::string &anim,
00053 eSide side=SIDE_LEFT) const;
00054 };
00055
00056 #endif