Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

peon::SceneFont Class Reference

This object of the Peon library is meant to encapsulate a textured font object for your game. More...

#include <SceneFont.h>

Inheritance diagram for peon::SceneFont:

peon::IUnknown List of all members.

Public Member Functions

 SceneFont ()
 Constructor.
 ~SceneFont ()
 Destructor.
bool loadFont (int width=16, int height=16, int spacing=14)
 This method is responsible for loading up our SceneFont instance.
void unloadFont ()
 This method is just used to unload our SceneFont instance.
void renderText (float xpos, float ypos, const String &strText)
 This method is the "workhorse" which renders our text.
void setColor (float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f)
 This method just sets our color components in case we want to apply any color to the text we're about to render.
bool beginBatchFont ()
 Sometimes we want to render batches of text to the screen...say like a story, dialog text or whatever.
void endBatchFont ()
 We need to ensure we pair a beginBatchFont with an endBatchFont.

Protected Attributes

GLuint m_display_list
 display list to contain alphabet
int m_char_width
 width of a single character
int m_char_height
 height of a single character
int m_char_spacing
 spacing between characters
int m_fxCount
 how many characters in a line/row
int m_fyCount
 how many characters in a column
float m_r
 the current red color when rendering our text
float m_g
 the current green color when rendering our text
float m_b
 the current blue color when rendering our text
float m_a
 the current alpha color when rendering our text
bool m_font_batching
 are we current batching text?

Detailed Description

This object of the Peon library is meant to encapsulate a textured font object for your game.

You provide it with a bitmap image of the alphabet you want to use (in ASCII format), then just notify this object of the dimensions of the bitmap. ie. how many rows and columns of characters there are, along with the pixel width and height of a single character.

This object is based off of the GLFont object made available by Jeff Molofee (aka. Nehe) at http://nehe.gamedev.net


Member Function Documentation

bool peon::SceneFont::beginBatchFont  ) 
 

Sometimes we want to render batches of text to the screen...say like a story, dialog text or whatever.

To minimize the state changes, let's create a way for the the program to batch all the font rendering commands THEN re-enable our original state/stacks..

Returns:
bool - are we ready to batch text?

bool peon::SceneFont::loadFont int  width = 16,
int  height = 16,
int  spacing = 14
 

This method is responsible for loading up our SceneFont instance.

Parameters:
width -
height -
spacing -
Returns:
bool - true if everything loaded properly

void peon::SceneFont::renderText float  xpos,
float  ypos,
const String &  strText
 

This method is the "workhorse" which renders our text.

We specify the x and y position of the text and that's where the SceneFont will render it!

Parameters:
xpos - x position of text
ypos - y position of text
strText - our text to render
Returns:
void

void peon::SceneFont::setColor float  r = 1.0f,
float  g = 1.0f,
float  b = 1.0f,
float  a = 1.0f
 

This method just sets our color components in case we want to apply any color to the text we're about to render.

Parameters:
r - red component
g - green component
b - blue component
a - alpha component
Returns:
void


The documentation for this class was generated from the following file:
Generated on Thu Dec 1 01:55:41 2005 for Peon by  doxygen 1.4.1