FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
FIFE::TextRenderPool Class Reference

#include <textrenderpool.h>

Collaboration diagram for FIFE::TextRenderPool:
Collaboration graph

Public Member Functions

 TextRenderPool (size_t poolSize=200)
 
 ~TextRenderPool ()
 
void invalidateCachedText ()
 
ImagegetRenderedText (FontBase *fontbase, const std::string &text)
 
void addRenderedText (FontBase *fontbase, const std::string &text, Image *image)
 
void removeOldEntries ()
 

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.

Todo:
Should probably use a std::map instead of a std::list

Definition at line 53 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 removeOldEntries().

FIFE::TextRenderPool::~TextRenderPool ( )

Destructor

Definition at line 50 of file textrenderpool.cpp.

Member Function Documentation

void FIFE::TextRenderPool::addRenderedText ( FontBase fontbase,
const std::string &  text,
Image image 
)

Add a string image

Definition at line 87 of file textrenderpool.cpp.

References FIFE::FontBase::getColor(), FIFE::FontBase::getGlyphSpacing(), FIFE::FontBase::getRowSpacing(), and FIFE::FontBase::isAntiAlias().

Referenced by FIFE::FontBase::getAsImage(), and FIFE::FontBase::getAsImageMultiline().

Here is the caller graph for this function:

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

Get a string image

Definition at line 57 of file textrenderpool.cpp.

References FIFE::FontBase::getColor(), FIFE::FontBase::getGlyphSpacing(), FIFE::FontBase::getRowSpacing(), and FIFE::FontBase::isAntiAlias().

Referenced by FIFE::FontBase::getAsImage(), and FIFE::FontBase::getAsImageMultiline().

Here is the caller graph for this function:

void FIFE::TextRenderPool::invalidateCachedText ( )

Invalidates all cached text images

Definition at line 134 of file textrenderpool.cpp.

void FIFE::TextRenderPool::removeOldEntries ( )

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

Definition at line 114 of file textrenderpool.cpp.

Referenced by TextRenderPool().

Here is the caller graph for this function:


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