#ifndef ANIMATEDTOON_H
#define ANIMATEDTOON_H

#include <stdint.h>

#include "SDL.h"

#include <vector>
#include <string>
#include <map>
#include "../util/Param.h"
#include "AffineTransformationMatrix.h"
#include "AudioTransformation.h"
#include "AnimatedAnimation.h"
#include "AnimatedState.h"
using namespace std;

#define ANIMATION_STATUS_STOP 0
#define ANIMATION_STATUS_PAUSE 1
#define ANIMATION_STATUS_PLAY 2

class AnimatedToon
{
 public:
  AnimatedToon ();
  ~AnimatedToon ();

  bool addAnimation (const string & name, AnimatedAnimation & anim);
  int numberOfAnimations ();
  void getAllAnimationNames (vector <string> & ans);
  void getAllGraphicFrames (vector <string> &);
  void getAllAudioBuffers (vector <string> &);
  void getNext(Param & hash,
	       AffineTransformationMatrix & atm,
	       AudioTransformation & at,
               AnimatedState & as);
  bool animationNameExists (const string & animName);
  int getAnimationDuration (const string & animName);

  void incRefCount ();
  void decRefCount ();
  uint32_t getRefCount ();
 private:
  map <string, AnimatedAnimation> :: iterator getAnimation (const string &);

  uint32_t refCount;
  map <string, AnimatedAnimation> animations;
};

#endif
