FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
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

◆ type_pool

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

Definition at line 93 of file textrenderpool.h.

Constructor & Destructor Documentation

◆ TextRenderPool()

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

Constructor Constructs a pool with a maximum of poolSize entries.

Definition at line 41 of file textrenderpool.cpp.

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

◆ ~TextRenderPool()

FIFE::TextRenderPool::~TextRenderPool ( )

Destructor.

Definition at line 49 of file textrenderpool.cpp.

References m_pool.

Member Function Documentation

◆ addRenderedText()

◆ getRenderedText()

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

◆ invalidateCachedText()

void FIFE::TextRenderPool::invalidateCachedText ( )

Invalidates all cached text images.

Definition at line 133 of file textrenderpool.cpp.

References m_pool.

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

+ Here is the caller graph for this function:

◆ removeOldEntries()

void FIFE::TextRenderPool::removeOldEntries ( )

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

Definition at line 113 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

◆ m_collectTimer

Timer FIFE::TextRenderPool::m_collectTimer
protected

Definition at line 98 of file textrenderpool.h.

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

◆ m_pool

type_pool FIFE::TextRenderPool::m_pool
protected

◆ m_poolMaxSize

size_t FIFE::TextRenderPool::m_poolMaxSize
protected

Definition at line 96 of file textrenderpool.h.

Referenced by addRenderedText(), and TextRenderPool().

◆ m_poolSize

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: