|
cswstex.h00001 /* 00002 Crystal Space Windowing System: Windowing System Texture class 00003 Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CSWSTEX_H__ 00021 #define __CSWSTEX_H__ 00022 00023 #include "csgfx/csimage.h" 00024 #include "csutil/csvector.h" 00025 00026 struct iTextureHandle; 00027 struct iTextureManager; 00028 00034 class csWSTexture 00035 { 00036 // Reference count 00037 int RefCount; 00038 // texture image 00039 iImage *Image; 00040 // Will be this texture used for 3D and/or for 2D operations? 00041 int Flags; 00042 // Red,Green and Blue components of key color 00043 uint8 tr, tg, tb; 00044 // texture has key color? 00045 bool HasKey; 00046 // Has transparent color changed? 00047 bool KeyChanged; 00048 // texture handle for the 3D/2D driver 00049 iTextureHandle *Handle; 00050 // texture name 00051 char *Name; 00052 // VFS file name 00053 char *FileName; 00054 00055 public: 00057 csWSTexture (const char *iName, iImage *Image, int iFlags); 00059 ~csWSTexture (); 00061 void SetKeyColor (int iR, int iG, int iB); 00063 void SetKeyColor (bool iEnable); 00065 void GetKeyColor (int &oR, int &oG, int &oB) 00066 { oR = tr; oG = tg; oB = tb; } 00068 bool HasKeyColor () 00069 { return HasKey; } 00071 void Register (iTextureManager *iTexMan); 00073 void Unregister (); 00075 void Refresh (); 00077 void SetName (const char *iName); 00079 const char *GetName () 00080 { return Name; } 00082 iTextureHandle *GetHandle () 00083 { return Handle; } 00085 void IncRef () 00086 { RefCount++; } 00088 void DecRef () 00089 { RefCount--; } 00091 int GetRefCount () const 00092 { return RefCount; } 00094 const char *GetFileName () const 00095 { return FileName; } 00097 void SetFileName (const char *iFileName); 00099 void FixKeyColor (); 00101 void DontFixKeyColor () 00102 { KeyChanged = false; } 00104 int GetWidth (); 00106 int GetHeight (); 00107 }; 00108 00110 class csWSTexVector : public csVector 00111 { 00112 public: 00114 csWSTexVector (); 00116 virtual ~csWSTexVector (); 00118 virtual bool FreeItem (csSome Item); 00120 virtual int CompareKey (csSome Item, csConstSome Key, int Mode) const; 00122 csWSTexture *Get (int idx) 00123 { return (csWSTexture *)csVector::Get (idx); } 00125 csWSTexture *FindTexture (const char *iName) 00126 { 00127 int idx = FindKey (iName); 00128 return idx >= 0 ? (csWSTexture *)Get (idx) : (csWSTexture*)NULL; 00129 } 00130 }; 00131 00132 #endif // __CSWSTEX_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |