struct TextureEntry
{
TextureEntry(const String &_Filename, const String &_ID, RenderType _Type)
{
Filename = _Filename;
ID = _ID;
FirstCharacter = '&';
if(ID.Length() > 0)
{
FirstCharacter = ID[0];
}
Type = _Type;
}
String Filename;
String ID;
char FirstCharacter;
RenderType Type;
};
typedef hash_map<UINT, TextureEntry*> TextureEntryMap;
class TextureEntryManager : public Manager
{
public:
void Init();
const TextureEntry* FindTextureMatch(const Bitmap &Bmp);
const TextureEntry* FindFontMatch(const Bitmap &Bmp);
private:
static String FontUpdateStringName(const String &ID);
const TextureEntry* FindMapMatch(const Bitmap &Bmp, const TextureEntryMap &Map);
void AddDirectory(const String &Folder, RenderType Type, TextureEntryMap &Map, set<UINT> &Set);
void AddBitmapFromFile(const String &Directory, const String &Filename, RenderType Type, TextureEntryMap &Map, set<UINT> &Set);
void InsertBitmapIntoMap(const Bitmap &Bmp, const String &Filename, const String &ID, RenderType Type, TextureEntryMap &Map);
void SaveMap(const TextureEntryMap &Map, const String &Filename);
void LoadMap(TextureEntryMap &Map, set<UINT> &Set, const String &Filename);
set<UINT> _TextureMapFilenameHashSet;
TextureEntryMap _TextureMap;
set<UINT> _FontMapFilenameHashSet;
TextureEntryMap _FontMap;
};