cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FontAtlas Class Reference

#include <CCFontAtlas.h>

Inheritance diagram for FontAtlas:
Ref

Public Member Functions

 FontAtlas (Font &theFont)
virtual ~FontAtlas ()
void addLetterDefinition (const FontLetterDefinition &letterDefinition)
bool getLetterDefinitionForChar (char16_t letteCharUTF16, FontLetterDefinition &outDefinition)
bool prepareLetterDefinitions (const std::u16string &utf16String)
const std::unordered_map
< ssize_t, Texture2D * > & 
getTextures () const
void addTexture (Texture2D *texture, int slot)
float getCommonLineHeight () const
void setCommonLineHeight (float newHeight)
Texture2D * getTexture (int slot)
const Font * getFont () const
void listenRendererRecreated (EventCustom *event)
 listen the event that renderer was recreated on Android/WP8 It only has effect on Android and WP8. More...
 
void purgeTexturesAtlas ()
 Removes textures atlas. More...
 
void setAntiAliasTexParameters ()
 sets font texture parameters: More...
 
void setAliasTexParameters ()
 sets font texture parameters: More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Ref * autorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()

Static Public Attributes

static const int CacheTextureWidth
static const int CacheTextureHeight
static const char * EVENT_PURGE_TEXTURES

Protected Member Functions

void relaseTextures ()
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 

Protected Attributes

std::unordered_map< ssize_t,
Texture2D * > 
_atlasTextures
std::unordered_map< unsigned
short, FontLetterDefinition > 
_fontLetterDefinitions
float _commonLineHeight
Font * _font
int _currentPage
unsigned char * _currentPageData
int _currentPageDataSize
float _currentPageOrigX
float _currentPageOrigY
float _letterPadding
int _fontAscender
EventListenerCustom * _rendererRecreatedListener
bool _antialiasEnabled
bool _rendererRecreate
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Constructor & Destructor Documentation

FontAtlas ( Font &  theFont)
virtual ~FontAtlas ( )
virtual

Member Function Documentation

void addLetterDefinition ( const FontLetterDefinition &  letterDefinition)
void addTexture ( Texture2D *  texture,
int  slot 
)
float getCommonLineHeight ( ) const
const Font* getFont ( ) const
bool getLetterDefinitionForChar ( char16_t  letteCharUTF16,
FontLetterDefinition &  outDefinition 
)
Texture2D* getTexture ( int  slot)
const std::unordered_map
<ssize_t, Texture2D*>
& getTextures
( ) const
inline
void listenRendererRecreated ( EventCustom *  event)

listen the event that renderer was recreated on Android/WP8 It only has effect on Android and WP8.

bool prepareLetterDefinitions ( const std::u16string &  utf16String)
void purgeTexturesAtlas ( )

Removes textures atlas.

It will purge the textures atlas and if multiple texture exist in the FontAtlas.

void relaseTextures ( )
protected
void setAliasTexParameters ( )

sets font texture parameters:

  • GL_TEXTURE_MIN_FILTER = GL_NEAREST
  • GL_TEXTURE_MAG_FILTER = GL_NEAREST
void setAntiAliasTexParameters ( )

sets font texture parameters:

  • GL_TEXTURE_MIN_FILTER = GL_LINEAR
  • GL_TEXTURE_MAG_FILTER = GL_LINEAR
void setCommonLineHeight ( float  newHeight)

Member Data Documentation

bool _antialiasEnabled
protected
std::unordered_map<ssize_t,
Texture2D*> _atlasTextures
protected
float _commonLineHeight
protected
int _currentPage
protected
unsigned char* _currentPageData
protected
int _currentPageDataSize
protected
float _currentPageOrigX
protected
float _currentPageOrigY
protected
Font* _font
protected
int _fontAscender
protected
std::unordered_map<unsigned
short, FontLetterDefinition>
_fontLetterDefinitions
protected
float _letterPadding
protected
bool _rendererRecreate
protected
EventListenerCustom*
_rendererRecreatedListener
protected
const int CacheTextureHeight
static
const int CacheTextureWidth
static
const char* EVENT_PURGE_TEXTURES
static

The documentation for this class was generated from the following file: