/*
File Name: Animation.h
Created By: Andy Odle
Date: Apr 5, 2010

Description: 
*/

#ifndef Animation_h
#define Animation_h

#include <string>
using namespace std;

#include "./source/inc/TimeGOC.h"
#include "./source/inc/TimerGOC.h"
#include "./source/inc/MathGOC.h"
#include "./source/PlatformSpecific/inc/Sprite.h"

struct Animation
{
     int startingColom_m;
     int startingRow_m;
     int numberOfFrames_m; 
     int frameWidth_m; 
     int frameHeight_m;
};

class AnimationGOC : public Sprite
{
    public:
        
        AnimationGOC();
        ~AnimationGOC();

        void InitiliseAnimation(string spriteStrip_p, 
                                int numberOfFrames_p, 
                                int frameWidth_p, 
                                int frameHeight_p,
                                int startingRow_p, 
                                int startingColom_p);

        void StartAnimation(int speed_p, TimeGOC *timeGOC_p);
        void PauseAnimation();
        void RestartAnimation();
        void StopAnimation();
        void AdvanceFrame();

    private:

        void ChangeCurrentFrame(int currentRow_p, int currentColom_p);
        void CalculateCurrentFrame();

    private:

        int startingIndex_m; // Used to keep track of where in the animation you are.
        int frameIndex_m;
        unsigned long timer_m;
        float framesInARow_m; // Number of rows of animation frames.
        float framesInAColom_m; // Number of coloms of animation frames.
        Animation currentAnimation_m; // Setting for the current frame of animation.
        TimerGOC *animationTimer_m;
};

#endif
