12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef _CCFontAtlasCache_h_
- #define _CCFontAtlasCache_h_
- #include <unordered_map>
- #include "base/ccTypes.h"
- NS_CC_BEGIN
- class FontAtlas;
- class Texture2D;
- struct _ttfConfig;
- class CC_DLL FontAtlasCache
- {
- public:
- static FontAtlas* getFontAtlasTTF(const _ttfConfig* config);
- static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset = Vec2::ZERO);
- static FontAtlas* getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
- static FontAtlas* getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
- static FontAtlas* getFontAtlasCharMap(const std::string& plistFile);
-
- static bool releaseFontAtlas(FontAtlas *atlas);
-
- static void purgeCachedData();
-
- static void reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset = Vec2::ZERO);
-
- static void unloadFontAtlasTTF(const std::string& fontFileName);
- private:
- static std::unordered_map<std::string, FontAtlas *> _atlasMap;
- };
- NS_CC_END
- #endif
|