TextureAtlasAnimation::TextureAtlasAnimation(TextureAtlas &atlas, const string &path, float fps, bool looping, bool reverse)
 :
 atlas(atlas),
 fps(fps),
 looping(looping)
 {
     if (reverse)
     {
         auto tmp = atlas.getAnimationSprites(path);
         
         for (int i = tmp.size() - 1; i >= 0; i--)
         {
             sprites.push_back(tmp[i]);
         }
     }
     else
     {
         sprites = atlas.getAnimationSprites(path);
     }
     
     if (sprites.empty())
     {
         throw runtime_error("INVALID ANIMATION");
     }
 }
 TextureAtlasAnimation::TextureAtlasAnimation(TextureAtlas &atlas, const string &path, float fps, bool looping, int firstFrameIndex, int lastFrameIndex)
 :
 atlas(atlas),
 fps(fps),
 looping(looping)
 {
     auto tmp = atlas.getAnimationSprites(path);
     
     if (((firstFrameIndex < 0) || (firstFrameIndex >= tmp.size()) || ((lastFrameIndex < 0) || (lastFrameIndex >= tmp.size()))))
     {
         throw runtime_error("OUT-OF-RANGE ANIMATION FRAMES");
     }
     
     if (firstFrameIndex < lastFrameIndex)
     {
         for (int i = firstFrameIndex; i <= lastFrameIndex; i++)
         {
             sprites.push_back(tmp[i]);
         }
     }
     else
     {
         for (int i = firstFrameIndex; i >= lastFrameIndex; i--)
         {
             sprites.push_back(tmp[i]);
         }
     }
     
     if (sprites.empty())
     {
         throw runtime_error("INVALID ANIMATION");
     }
 }