gcn::HGEImageFont Class Reference

#include <hgeimagefont.hpp>

Inheritance diagram for gcn::HGEImageFont:

gcn::Font List of all members.

Detailed Description

Font to be used with HGE.

As HGE does not support colorkey blitting of images it's recommended to use HGE's internal font in Guichan.

Author:
Kevin Lynx
Since:
0.6.1

Definition at line 77 of file hgeimagefont.hpp.

Public Member Functions

void drawString (Graphics *graphics, const std::string &text, int x, int y)
 Draws a string.
virtual hgeFont * getFont () const
 Gets the loaded HGE font.
int getHeight () const
 Gets the height of the glyphs in the font.
int getStringIndexAt (const std::string &text, int x)
int getWidth (const std::string &text) const
 Gets the width of a string.
int getWidth (char character) const
 Gets the width from a character.
 HGEImageFont (const std::string &filename)
 Constructor.
 ~HGEImageFont ()
 Destructor.

Protected Attributes

hgeFont * mHGEFont


Constructor & Destructor Documentation

gcn::HGEImageFont::HGEImageFont ( const std::string &  filename  ) 

Constructor.

Creates a font from a HGE font file.

Parameters:
filename the filename of the HGE font.

Definition at line 68 of file hgeimagefont.cpp.

References mHGEFont.


Member Function Documentation

void gcn::HGEImageFont::drawString ( Graphics graphics,
const std::string &  text,
int  x,
int  y 
) [virtual]

Draws a string.

NOTE: You normally won't use this function to draw text since Graphics contains better functions for drawing text.

Parameters:
graphics A Graphics object to use for drawing.
text The string to draw.
x The x coordinate where to draw the string.
y The y coordinate where to draw the string.

Implements gcn::Font.

Definition at line 120 of file hgeimagefont.cpp.

References gcn::Color::a, gcn::Color::b, gcn::Color::g, gcn::Graphics::getColor(), mHGEFont, and gcn::Color::r.

hgeFont * gcn::HGEImageFont::getFont (  )  const [virtual]

Gets the loaded HGE font.

The HGE font can be used to set certain properties like setting the blend mode. Properties of the HGE font will effect the Guichan font as well.

Returns:
the loaded HGE font.

Definition at line 78 of file hgeimagefont.cpp.

References mHGEFont.

int gcn::HGEImageFont::getHeight (  )  const [virtual]

Gets the height of the glyphs in the font.

Returns:
The height of the glyphs int the font.

Implements gcn::Font.

Definition at line 97 of file hgeimagefont.cpp.

References mHGEFont.

int gcn::HGEImageFont::getWidth ( const std::string &  text  )  const [virtual]

Gets the width of a string.

The width of a string is not necesserily the sum of all the widths of it's glyphs.

Parameters:
text The string to return the width of.
Returns:
The width of a string.

Implements gcn::Font.

Definition at line 83 of file hgeimagefont.cpp.

References mHGEFont.

int gcn::HGEImageFont::getWidth ( char  character  )  const

Gets the width from a character.

Parameters:
character the character to get the width from.

Definition at line 88 of file hgeimagefont.cpp.

References mHGEFont.

Referenced by getStringIndexAt().


The documentation for this class was generated from the following files:
Generated on Sun Jan 20 21:48:15 2008 for Guichan by  doxygen 1.5.2