#pragma once

#include "Array.h"

namespace Framework
{
    class Image;
    class Animation2DData;

    class Texture2D : public virtual ReferenceCounter
    {
    private:
        struct Animation
        {
            Animation2DData* data;
            int now;
            double compensation;
        };

        bool circularAnimation;
        int animationIndex;
        Image* txt;
        Array<Animation*>* animData;

    public:
        //! Constructor
        DLLEXPORT Texture2D();
        //! Destructor
        DLLEXPORT ~Texture2D();
        //! Sets whether the animation should repeat automatically
        //! \param ca 1 if the animation should repeat automatically
        DLLEXPORT void setCircularAnimation(bool ca);
        //! Sets a pointer to the texture (if not animated)
        //! \param textur The pointer to the image
        DLLEXPORT void setTextureZ(Image* textur);
        //! Adds an animation
        //! \param textur The pointer to the animation data
        DLLEXPORT void addAnimationZ(Animation2DData* textur);
        //! Sets the current animation
        //! \param index The index of the animation
        DLLEXPORT void setAnimation(int index);
        //! Activates the next animation
        DLLEXPORT void nextAnimation();
        //! Sets the elapsed time since the last call
        //! \param t The elapsed time in seconds
        DLLEXPORT bool tick(double t);
        //! Returns the current texture
        DLLEXPORT Image* zTexture() const;
    };
} // namespace Framework