#ifndef ANIMATEDANIMATION_H
#define ANIMATEDANIMATION_H

#include <stdint.h>

#include "SDL.h"

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

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

  uint32_t getDuration ();

  int getNumLoops ();
  void setNumLoops (int);

  void add (Param & hash, AffineTransformationMatrix & atm,
            AudioTransformation & at);

  void get (Param & hash, AffineTransformationMatrix & atm,
	    AnimatedState & as,
	    AudioTransformation & at);

  void getAllGraphicFrames (vector <string> &);
  void getAllAudioBuffers (vector <string> &);

  void clear ();

 private:
  int32_t getFrameHelper(uint32_t timeElapsed);
  uint32_t getLoopElapsedTimeIsIn(uint32_t timeElapsed);
  uint32_t getElapsedTimeInThisLoop(uint32_t timeElapsed);

  vector<string> frames;
  vector<AffineTransformationMatrix> atms;
  vector<string> sounds;
  vector<AudioTransformation> ats;
  vector<uint32_t> timeFrameShouldEnd;
  int numLoops;
};

#endif
