e2d::graphics::Label Class Reference

Inheritance diagram for e2d::graphics::Label:

e2d::core::Rect

List of all members.


Detailed Description

Use this class to blit text with a pre-loaded font.

Public Member Functions

 Label (int buffer_size)
 Constructor.
 Label (const Label &other)
 Copy constructor.
void AppendText (char *text,...)
 Appends to the existent text.
void Blit (SDL_Surface *destination)
 Blits text.
int GetBufferSize (void)
 Gets the buffer size.
FontGetFont (void)
 Gets the font.
const char * GetText (void)
 Gets this label's text.
void SetFont (Font *font)
 Sets the font.
void SetText (char *text,...)
 Sets the text for this label.

Constructor & Destructor Documentation

e2d::graphics::Label::Label ( int  buffer_size  ) 

You must specify, in this constructor, the maximum size of the text held by this label, in number of characters.

e2d::graphics::Label::Label ( const Label other  ) 

Creates a copy of another label.


Member Function Documentation

void e2d::graphics::Label::AppendText ( char *  text,
  ... 
)

Appends to the existent text. If there was already a font assigned to this label, this label's W and H properties (inherited from Rect) shall be set to the size in pixels this text will occupy if blitted somewhere. You can use this method the same way you would use printf (with all formatting options).

Parameters:
text Text to blit.

void e2d::graphics::Label::Blit ( SDL_Surface *  destination  ) 

Blits the message set to this label, using the font set to this label. The label will be blitted having its upper-left corner at position X, Y of the destination, where X and Y are this label's X and Y attributes inherited from Rect.

Parameters:
destination Pointer to an SDL_Surface where the text will be blitted (may be the Video::framebuffer or any other surface).
Exceptions:
e2d::core::Exception if there was no font assigned to this label, of if there was any error blitting.

int e2d::graphics::Label::GetBufferSize ( void   ) 

Returns:
the current buffer size

Font * e2d::graphics::Label::GetFont ( void   ) 

Gets the font assigned to this label.

Returns:
a pointer to Font, or NULL if no font was assigned.

const char * e2d::graphics::Label::GetText ( void   ) 

Gets the text set to this label

Returns:
text

void e2d::graphics::Label::SetFont ( Font font  ) 

Assigns a font to this label.

Parameters:
font Font for this label to blit text with.

void e2d::graphics::Label::SetText ( char *  text,
  ... 
)

Sets the text this label shall blit. If there was already a font assigned to this label, this label's W and H properties (inherited from Rect) shall be set to the size in pixels this text will occupy if blitted somewhere. You can use this method the same way you would use printf (with all formatting options).

Parameters:
text Text to blit.


Generated on Tue Dec 8 10:32:45 2009 for Easy2D by  doxygen 1.5.6