Back to index

kdeartwork  4.3.2
Public Member Functions | Private Attributes | Friends
Word Class Reference

#include <firesaverwriter.h>

List of all members.

Public Member Functions

 Word (const char *text, QMap< char, Symbol * > *map, float scale=1.0)
void renderWord (double dT)
bool isDead ()

Private Attributes

float width
float scale
float cX
float cY
float vScale
float vX
float vY
float activateTime
float lifeTime
float currentTime
float color [4]
Q3PtrList< SymbolsymbolList

Friends

class Writer

Detailed Description

Definition at line 59 of file firesaverwriter.h.


Constructor & Destructor Documentation

Word::Word ( const char *  text,
QMap< char, Symbol * > *  map,
float  scale = 1.0 
)

Definition at line 28 of file firesaverwriter.cpp.

    : width(0), scale(_scale), cX(0), cY(0), vScale(0), vX(0), vY(0),
    activateTime(0.0), lifeTime(2), currentTime(0)
{
       for ( ; *_text != 0 && *_text != ' '; _text++ )
       {
              char c = *_text;
              if ( !sMap->contains(c) )   //search for a symbol in the map
                     continue;
              Symbol * symbol = (*sMap)[c];      //get the symbol*
              width += symbol->scale;            //increase word's half-width
              symbolList.append( symbol );       //insert it to the list
       }
       color[0] = 0;
       color[1] = 0.8 * drand48();
       color[2] = 0.2 + 0.8 * drand48();
       color[3] = 1;
}

Member Function Documentation

bool Word::isDead ( ) [inline]

Definition at line 79 of file firesaverwriter.cpp.

{
       if ( activateTime > 0 )
              return (currentTime - activateTime) >= lifeTime;
       return currentTime >= lifeTime;
}

Here is the caller graph for this function:

void Word::renderWord ( double  dT) [inline]

Definition at line 47 of file firesaverwriter.cpp.

{
       if ( (currentTime += dT) < activateTime )
              return;

       //update coloring
       if ( activateTime >= 0 ) {
              if ( currentTime < activateTime + 0.4 )
                     color[3] = (currentTime - activateTime) / 0.4;
              else
                     color[3] = 1 - (currentTime - activateTime - 0.4) / (lifeTime - 0.4);
       } else
              color[3] = 1 - currentTime / lifeTime;

       //word's global transforms
       glPushMatrix();
       glTranslatef( cX - scale * width, cY, 0 );
       glScalef( scale, scale, 1 );
       glColor4fv( color );

       //for each symbol draw it!
       Symbol * symbol = symbolList.first();
       for( ; symbol; symbol = symbolList.next() )
              symbol->renderSymbol();
       glPopMatrix();

       //physical update to position and scale
       cX += vX * dT;
       cY += vY * dT;
       scale += scale * vScale * dT;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class Writer [friend]

Definition at line 61 of file firesaverwriter.h.


Member Data Documentation

float Word::activateTime [private]

Definition at line 71 of file firesaverwriter.h.

float Word::color[4] [private]

Definition at line 72 of file firesaverwriter.h.

float Word::currentTime [private]

Definition at line 71 of file firesaverwriter.h.

float Word::cX [private]

Definition at line 69 of file firesaverwriter.h.

float Word::cY [private]

Definition at line 69 of file firesaverwriter.h.

float Word::lifeTime [private]

Definition at line 71 of file firesaverwriter.h.

float Word::scale [private]

Definition at line 69 of file firesaverwriter.h.

Q3PtrList<Symbol> Word::symbolList [private]

Definition at line 73 of file firesaverwriter.h.

float Word::vScale [private]

Definition at line 70 of file firesaverwriter.h.

float Word::vX [private]

Definition at line 70 of file firesaverwriter.h.

float Word::vY [private]

Definition at line 70 of file firesaverwriter.h.

float Word::width [private]

Definition at line 69 of file firesaverwriter.h.


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