#include <SceneFont.h>
Inheritance diagram for peon::SceneFont:
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? |
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
|
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..
|
|
This method is responsible for loading up our SceneFont instance.
|
|
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!
|
|
This method just sets our color components in case we want to apply any color to the text we're about to render.
|