List of all members.
Detailed Description
Font Resource.
Implements a Font resource.
Constructor & Destructor Documentation
| Font::Font |
( |
const std::string & |
filePath, |
|
|
Uint |
ptSize | |
|
) |
| | |
| Font::Font |
( |
Uint |
ptSize |
) |
|
Another alternative way to load a Font with a specified point size.
- Parameters:
-
| ptSize | Point size of the font. Defaults to 12pt. |
| Font::Font |
( |
const Font & |
font |
) |
|
A basic copy constructor.
Creates a new copy of a Font Resource from another Font.
An alternative way to load a Font using a default point size (10).
Using the default method of instantiating a Font object will yield a 10pt default typeface.
Member Function Documentation
| std::string Font::buildName |
( |
|
) |
[private] |
Build Font Name with Family Name and Style Name.
This function is called interally to create a Font name based on Font family and Font style.
| TTF_Font * Font::getFont |
( |
|
) |
const |
Should this be private and just friend the Renderer class?
Returns an SDL TTF_Font object.
- Todo:
- This is mostly a design issue but we should probably never pass out a data type specific to an API other than our own framework. I would simply pass out a std::string but that would require that the Renderer using Font's do conversions on the fly which can cause a real performance bottleneck. I think our best bet would be to build a resource manager within the Renderer class that handles this sort of conversion for all related resources and stores them until they're no longer needed much like the OpenGL Renderer stores converted SDL_Surface's.
| const std::string & Font::getFontName |
( |
|
) |
const |
Returns the typeface name.
- Returns:
- Returns NULL if an error occurs.
| Uint Font::getHeight |
( |
|
) |
const |
Returns the height in pixels of the font.
| Uint Font::getWidth |
( |
const std::string & |
str |
) |
const |
| void Font::load |
( |
|
) |
[private, virtual] |
Loads a Font file.
This is the normal method of loading a Font Resource and is called internally by the constructor. It is not publicly exposed and should never be called anywhere except the constructor.
Implements Resource.
| void Font::setStyle |
( |
FontStyle |
style = STYLE_NORMAL |
) |
|
Sets the style of the font to use for rendering.
- Parameters:
-
| style | Sets the style of the font. Can be STYLE_NORMAL (default), STYLE_BOLD, STYLE_ITALIC or STYLE_UNDERLINE. |
Member Data Documentation
Persistent memory buffer for TTF_Font.
Point Size to load the Font in.
The documentation for this class was generated from the following files:
- C:/Development/LoM/client/src/Resources/Font.h
- C:/Development/LoM/client/src/Resources/Font.cpp