#ifndef SPRITE_H_INCLUDED
#define SPRITE_H_INCLUDED

#include "Engine.h"

class cSprite : public cRenderObject
{
    private:
    protected:
        SDL_Surface *m_SpriteSurface;
        int m_FrameCount;
        int m_Size;
        bool m_Playing;

        Uint32 m_StartTime;
        Uint32 m_CurrentTime;

        //If playing then update current frame according to time
        void updateAnim();

    public:
        int m_FPS;
        int m_FrameNumer;
        int m_CurrentFrame;

        int m_XPos;
        int m_YPos;
        int m_ColourKey;
        bool m_EnableColourKey;

        cSprite(std::string Name, int FrameCount, int Size);
        ~cSprite();

        //Overloaded virtual draw
        void update(SDL_Surface *Screen);
        bool updateKey(SDLKey Key);
        SDL_Surface* loadSprite(std::string Filename, bool enableColourKey = false, int colourKey = 0);

        //Start and stop methods for playback of sprite
        void play() {m_Playing = true; m_CurrentFrame = 0; m_StartTime = SDL_GetTicks();}
        void stop() {m_Playing = false;}

        const bool getPlaying() {return m_Playing;}
};


#endif // SPRITE_H_INCLUDED
