///////////////////////////////////////////////////////////////////////////////////////////
// Sprite.h
//
//  Definition of the Sprite class, which represents a rectangular textured object
// on the screen, with a 1:1 mapping between texels and pixels.

#pragma once

#include "Texture.h"
#include "SpriteManager.h"

namespace Sunlight
{
    namespace DirectX
    {
        namespace Graphics
        {
            // Represents a rectangular textured sprite.
            __gc public class Sprite
            {
            public:
                Sprite(SpriteManager *pManagerObject, System::Drawing::Rectangle rDimensions, Texture *pTextureObject, System::Drawing::Point ptSourcePosition);
                Sprite(SpriteManager *pManagerObject, System::Drawing::Rectangle rDimensions, Texture *pTextureObject, System::Drawing::Point ptSourcePosition, int nFramesAcross);

                // The SpriteManager object used to manage this object.
                SpriteManager *ManagerObject;
                // The Texture object which contains this object's image.
                Texture *TextureObject;
                // The x-position of this object on the screen.
                int Left;
                // The y-position of this object on the screen.
                int Top;
                // The width of the object.
                int Width;
                // The height of the object.
                int Height;
                // The x-position of this object in the source texture.
                int SourceLeft;
                // The y-position of this object in the source texture.
                int SourceTop;
                // The width of this object in the source texture.
                int SourceWidth;
                // The height of this object in the source texture.
                int SourceHeight;
                // The number of frames in one line.
                int FramesAcross;
                // The current animation frame.
                int CurrentFrame;
                // Sets/returns the offset of the sprite's underlying shadow.
                int ShadowDepth;
                // Gets a rectangle enclosing the object.
                __property Drawing::Rectangle get_Bounds();
                // Draw this sprite using its SpriteManager.
                void Draw();

                // Fill an array of SpriteVertexes with the vertex co-ordinates and texture co-ordinates.
                void FillVertexArray(SpriteManager::SpriteVertex __nogc *vertices);
            };
        }
    }
}