My Project
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 namespace SallyAPI 00029 { 00030 namespace Core 00031 { 00032 class CTexture; 00033 } 00034 } 00035 00036 #pragma once 00037 #include "Define.h" 00038 #include <map> 00039 #include "Texture.h" 00040 #include "AutoLock.h" 00041 00042 namespace SallyAPI 00043 { 00044 namespace Core 00045 { 00054 00055 class DLL_API_SALLY CTextureManager 00056 { 00057 private: 00058 static SallyAPI::Core::CTextureManager* m_pObject; 00059 00060 int m_iCounter; 00061 std::vector<SallyAPI::Core::CTexture*> m_vTextures; 00062 std::map<int, SallyAPI::Core::CTexture*> m_mTexturesRenderTarget; 00063 SallyAPI::System::CCritSection m_Lock; 00064 00065 int GetNextId(); 00066 00067 CTextureManager(); 00068 ~CTextureManager(); 00069 public: 00070 static SallyAPI::Core::CTextureManager* GetInstance(); 00071 static void DeleteInstance(); 00072 00073 SallyAPI::Core::CTexture* LoadTexture(const std::string& fileName, bool createMipMaps = false); 00074 SallyAPI::Core::CTexture* CreateEmptyTexture(int iWidth, int iHeight, D3DFORMAT d3dFormat); 00075 SallyAPI::Core::CTexture* CreateEmptyTextureAsRenderTarget(int iWidth, int iHeight, D3DFORMAT d3dFormat); 00076 00077 SallyAPI::Core::CTexture* GetTextureById(int id); 00078 SallyAPI::Core::CTexture* GetTextureByName(const std::string& fileName); 00079 00080 bool RemoveTextureById(int id); 00081 bool RemoveTextureByName(const std::string& fileName); 00082 bool RemoveTextureByTexture(SallyAPI::Core::CTexture* texture); 00083 }; 00084 } 00085 }