Classes | Functions

Glut Font Effects
[Glut Font Library]

Font effects based on the Glut Font Library library. More...

Collaboration diagram for Glut Font Effects:

Classes

class  glut::FontEffect
 general base class for font effect objects. More...

Functions

virtual void glut::FontEffect::tick (float deltaSeconds)=0
 tick the effect.
virtual void glut::FontEffect::render (void)=0
 draw. Usually called each frame.
virtual void glut::FontEffect::reset (void)=0
 reset (restart) the effect
virtual void glut::FontEffect::advance (void)=0
 advance the effect.
virtual void glut::FontEffect::complete (void)=0
 complete the effect.
smart_ptr< FontEffect > glut::getCharacterAdvanceEffect (smart_ptr< Font > &font,const char *lines,int millisecondsPerCharacter,const glut_color_t &color)
 this font effect will write out lines of text one character at a time.
void glut::breakLongString (const char *text,Font *font,int maxPixelWidth,std::string &output)
 given a long sequence of words in a given font, this routine returns the same words, only with line breaks inserted so that a single line is never longer than the specified width.

Detailed Description

Font effects based on the Glut Font Library library.


Function Documentation

virtual void glut::FontEffect::tick ( float  deltaSeconds  )  [pure virtual, inherited]

tick the effect.

Caller provides time in seconds since the previous call. Implementors should ignore zero or negative time deltas (these can happen if system clocks reset etc.). Usually this is called per frame of animation, with deltaSeconds on the order of a few milliseconds.

virtual void glut::FontEffect::render ( void   )  [pure virtual, inherited]

draw. Usually called each frame.

virtual void glut::FontEffect::reset ( void   )  [pure virtual, inherited]

reset (restart) the effect

virtual void glut::FontEffect::advance ( void   )  [pure virtual, inherited]

advance the effect.

Effects usually advance on their own. Clients can call this method if they need to move the effect on faster (for instance, user is pushing the "next" button). Often this will fast-forward to the next line, for instance. In some cases this is equivalent to calling complete() below.

virtual void glut::FontEffect::complete ( void   )  [pure virtual, inherited]

complete the effect.

Client can use this to fast-forward the effect to get to the end. Again, this is often used so that users can skip any animations so they can move ahead quicker.

smart_ptr< FontEffect > glut::getCharacterAdvanceEffect ( smart_ptr< Font > &  font,
const char *  lines,
int  millisecondsPerCharacter,
const glut_color_t color 
)

this font effect will write out lines of text one character at a time.

The lines parameter can contain multiple lines of text, separated by newline characters.

void glut::breakLongString ( const char *  text,
Font *  font,
int  maxPixelWidth,
std::string &  output 
)

given a long sequence of words in a given font, this routine returns the same words, only with line breaks inserted so that a single line is never longer than the specified width.

Note that really long words won't be broken up (you'll have a single line with a word that is too long).