The Texture Class


 public:
 Texture()  { texHandle = NULL; imageData = NULL; palette = NULL; refCount = 0; flags = 0; };
 ~Texture()  { ShiAssert( refCount == 0 ); };

 static void SetupForDevice( MPRHandle_t texRC, char *path );

 void LoadImage( char *filename, DWORD newFlags = 0 );
 void FreeImage( void );

 void CreateTexture( void );
 void FreeTexture( void );

 void UpdateMPR( void );

 void LoadAndCreate( char *filename, DWORD newFlags = 0 ) { LoadImage(filename, newFlags); CreateTexture(); };
 void FreeAll( void )          { FreeTexture(); FreeImage(); };

  public:
 int   width;
 int   height;

 void  *imageData;

 Palette  *palette;
 DWORD  flags;
 DWORD  chromaKey;
 DWORD  texHandle;

  protected:
 int   refCount;