FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::TextRenderPool Class Reference

Generic pool for rendered text Caches a number of Images with text, as rendered by a Font. More...

#include <textrenderpool.h>

+ Collaboration diagram for FIFE::TextRenderPool:

Classes

struct  s_pool_entry
 

Public Member Functions

 TextRenderPool (size_t poolSize=200)
 Constructor Constructs a pool with a maximum of poolSize entries. More...
 
 ~TextRenderPool ()
 Destructor. More...
 
void invalidateCachedText ()
 Invalidates all cached text images. More...
 
ImagegetRenderedText (FontBase *fontbase, const std::string &text)
 Get a string image. More...
 
void addRenderedText (FontBase *fontbase, const std::string &text, Image *image)
 Add a string image. More...
 
void removeOldEntries ()
 Remove entries not used since a minute Is a timer callback. More...
 

Protected Types

typedef std::list< s_pool_entrytype_pool
 

Protected Attributes

type_pool m_pool
 
size_t m_poolSize
 
size_t m_poolMaxSize
 
Timer m_collectTimer
 

Detailed Description

Generic pool for rendered text Caches a number of Images with text, as rendered by a Font.

Makes sure no more than a maximum number of strings is pooled at a time. Automatically removes pooled strings not used for a minute. Doesn't use resources (apart from a minimum) if not used after a while.

Definition at line 53 of file textrenderpool.h.

Member Typedef Documentation

typedef std::list<s_pool_entry> FIFE::TextRenderPool::type_pool
protected

Definition at line 93 of file textrenderpool.h.

Constructor & Destructor Documentation

FIFE::TextRenderPool::TextRenderPool ( size_t  poolSize = 200)

Constructor Constructs a pool with a maximum of poolSize entries.

Definition at line 42 of file textrenderpool.cpp.

References m_collectTimer, m_poolMaxSize, m_poolSize, removeOldEntries(), FIFE::Timer::setCallback(), and FIFE::Timer::setInterval().

FIFE::TextRenderPool::~TextRenderPool ( )

Destructor.

Definition at line 50 of file textrenderpool.cpp.

References m_pool.

Member Function Documentation

Image * FIFE::TextRenderPool::getRenderedText ( FontBase fontbase,
const std::string &  text 
)
void FIFE::TextRenderPool::invalidateCachedText ( )

Invalidates all cached text images.

Definition at line 134 of file textrenderpool.cpp.

References m_pool.

Referenced by FIFE::FontBase::invalidate().

+ Here is the caller graph for this function:

void FIFE::TextRenderPool::removeOldEntries ( )

Remove entries not used since a minute Is a timer callback.

Definition at line 114 of file textrenderpool.cpp.

References FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), m_collectTimer, m_pool, m_poolSize, and FIFE::Timer::stop().

Referenced by TextRenderPool().

+ Here is the caller graph for this function:

Member Data Documentation

Timer FIFE::TextRenderPool::m_collectTimer
protected

Definition at line 98 of file textrenderpool.h.

Referenced by addRenderedText(), removeOldEntries(), and TextRenderPool().

type_pool FIFE::TextRenderPool::m_pool
protected
size_t FIFE::TextRenderPool::m_poolMaxSize
protected

Definition at line 96 of file textrenderpool.h.

Referenced by addRenderedText(), and TextRenderPool().

size_t FIFE::TextRenderPool::m_poolSize
protected

Definition at line 95 of file textrenderpool.h.

Referenced by addRenderedText(), removeOldEntries(), and TextRenderPool().


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