///////////////////////////////////////////////////////////////////////////////////////////
// Texture.h
//
//  Definition of the Texture class, which wraps a Direct3D 8 texture.

#pragma once

#include "Device.h"

using namespace System;
using namespace System::ComponentModel;
            
namespace Sunlight
{
    namespace DirectX
    {
        namespace Graphics
        {
            // Wraps an unfiltered, managed Direct3D 8 texture.
            __gc public class Texture
            {
            protected:
                bool    m_bCreated;
                Device  *m_pDeviceObject;

                IDirect3DTexture8 __nogc *m_pTexture;

                // Called when the parent device is created.
                void OnDeviceCreated(Object *sender, EventArgs *e);
                // Called when the parent device is destroyed.
                void OnDeviceDestroyed(Object *sender, EventArgs *e);

            public:
                Texture();
                ~Texture();

                // The Device object with which this texture will be created.
                __property Device *get_DeviceObject();
                __property void set_DeviceObject(Device *);
                // The filename of the bitmap from which this texture will be created.
                String *Filename;

                // The Direct3D texture object underlying this object.
                __property IDirect3DTexture8 __nogc *get_Direct3DTexture();

                // The width of the texture.
                __property int get_Width();
                // The height of the texture.
                __property int get_Height();

                // Creates the texture object.
                virtual void Create();
                // Destroys the texture object.
                virtual void Destroy();
            };
        }
    }
}