Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ZE::ZFont Class Reference

#include <ZE_ZFont.h>

Inherits ZE::ZObject.

List of all members.


Detailed Description

ZFont font container class, class wraps common features of SDL_TTF. Inherited from ZObject.


Public Methods

 ZFont ()
 Default Constructor.

 ZFont (string filename, int size)
 Constructor that opens a font with a certain size.

 ~ZFont ()
 Destructor, frees memory.

void Open (string filename, int size)
 Opens a font with a certain size.

void Release ()
 Release font.

void DrawText (string text, ZImage &image)
 Draws a string in a color to a ZImage.

void DrawShadedText (string text, ZImage &image)
 Draws a string with a colored background to a ZImage.

void SetColor (Uint8 r, Uint8 g, Uint8 b)
 Set Text rColor.

void SetBGColor (Uint8 r, Uint8 g, Uint8 b)
 Set Background rColor.

void SetStyle (bool bold, bool italic, bool underline)
 Set display format.

void Resize (int size)
 Resize Font.

bool IsLoaded ()
 Check if file is loaded.

bool IsBold ()
 Get Bold Setting.

bool IsItalic ()
 Get Italic Setting.

bool IsUnderlined ()
 Get Underlined Setting.

int Height ()
 Get Height of Font.

int LineSkip ()
 Get Line Skip for Font.

int StringWidth (string text)
 Get String Width.

int StringHeight (string text)
 Get String Height.


Protected Attributes

TTF_Font * rFont
 Pointer to font data.

string rFilename
 Filename, for resizing.

SDL_Color rColor
 SDL_Color for current text color.

SDL_Color rBGColor
 SDL_Color for background color to be used in shaded draws.


Constructor & Destructor Documentation

ZE::ZFont::ZFont  
 

Default Constructor, does nothing.

ZE::ZFont::ZFont string    filename,
int    size
 

Constructor simply calls ZFont::Open() with same parameters.

Parameters:
filename Font to open.
size Size to use for font.

ZE::ZFont::~ZFont  
 

Destructor calls ZFont::Release().


Member Function Documentation

void ZE::ZFont::Open string    filename,
int    size
 

Opens a font given a filename and a point size.

Parameters:
filename Font to open.
size Size to use for font.

void ZE::ZFont::Release  
 

Release memory held by font.

void ZE::ZFont::DrawText string    text,
ZImage   image
 

Draw to a surface in specified color and associate that surface with a ZImage.

Parameters:
text String to write.
image ZImage to draw to.

void ZE::ZFont::DrawShadedText string    text,
ZImage   image
 

Draw to a surface a string with a background of rBGColor and lettering in the normal color and associate that surface with a ZImage.

Parameters:
text String to write.
image ZImage to draw to.

void ZE::ZFont::SetColor Uint8    r,
Uint8    g,
Uint8    b
 

Set rColor of Text Output.

Parameters:
r Red component of color (0-255).
g Green component of color (0-255).
b Blue component of color (0-255).

void ZE::ZFont::SetBGColor Uint8    r,
Uint8    g,
Uint8    b
 

Set rColor of Background for Shaded Draw.

Parameters:
r Red component of color (0-255).
g Green component of color (0-255).
b Blue component of color (0-255).

void ZE::ZFont::SetStyle bool    bold,
bool    italic,
bool    underline
 

Set display format (bold, italic, underline).

Parameters:
bold Decides bold setting of font.
italic Decides italic setting of font.
underline Decides underline setting of font.

void ZE::ZFont::Resize int    size
 

Release and Reopen font in new size.

Parameters:
size New size for font.

bool ZE::ZFont::IsLoaded  
 

Check if file is loaded and pointer to data is non-NULL.

Returns:
Loaded or Unloaded state of data.

bool ZE::ZFont::IsBold  
 

Check if font output is currently bold.

Returns:
True or False state of bold.

bool ZE::ZFont::IsItalic  
 

Check if font output is currently italic.

Returns:
True or False state of italic.

bool ZE::ZFont::IsUnderlined  
 

Check if font output is currently underline.

Returns:
True or False state of underline.

int ZE::ZFont::Height  
 

Check font height as reported by SDL_ttf.

Returns:
Height of font.

int ZE::ZFont::LineSkip  
 

Check font line skip as reported by SDL_ttf.

Returns:
Recommended Line Skip of font.

int ZE::ZFont::StringWidth string    text
 

Get Width of String in Current Font in Pixels.

Parameters:
text String to get width of.
Returns:
Width of String in Current font.

int ZE::ZFont::StringHeight string    text
 

Get Height of String in Current Font in Pixels.

Parameters:
text String to get height of.
Returns:
Height of String in Current font.


The documentation for this class was generated from the following file:
Generated on Wed Dec 11 23:42:26 2002 for ZEngine by doxygen1.3-rc1