home *** CD-ROM | disk | FTP | other *** search
- #ifndef __Animator_h__
- #define __Animator_h__
-
- #include "File.h"
-
- enum animations_e{
- ANIMATION_LEGS_FORWARD = 0,
- ANIMATION_LEGS_BACKWARD,
-
- ANIMATION_WEAPON_RELOAD,
-
- NUM_ANIMATIONS
- };
-
- typedef struct animation_s{
- int firstKeyframe;
- int lastKeyframe;
- int firstLoopKeyframe;
- int lastLoopKeyframe;
- int numLoopKeyframes;
- int millisPerKeyframe;
- }animation_t;
-
- class Animator{
- public:
- animation_t animations[NUM_ANIMATIONS];
-
- Animator(const char* filename);
- Animator(const Animator& animator);
- ~Animator();
-
- void start();
- void pause();
- void stop();
- float calcCurrentFrame();
- void setCurrentFrame(float newCurrentFrame);
- float getCurrentFrame();
-
- void setCurrentAnimation(int animationId);
- int getCurrentAnimation();
-
- void setLooping(bool looping);
- bool getLooping();
- void setPlayBackwards(bool newPlayBackwards);
- bool getPlayBackwards();
-
- static int getAnimationIdByName(const char* name);
-
- protected:
- int currentAnimation;
- float currentFrame;
- bool running;
- bool looping;
- bool playBackwards;
-
- unsigned long lastCalcMillis;
-
-
- bool readFromFile(File* f);
- };
-
- #endif /* __Animator_h__ */
-