Text object. More...
#include <gelText.h>
Public Member Functions | |
GelText () | |
Default constructor. | |
GelText (GelFont *fnt) | |
Convenience constructor. | |
GelText (GelFont *fnt, const char *st,...) | |
Convenience constructor. | |
GelText (GelFont *fnt, Gel2dVec obj_pos) | |
Convenience constructor. | |
~GelText () | |
Destructor. | |
GelFont * | getFont () const |
Gets the font associated with this text object. | |
void | setFont (GelFont *fnt) |
Sets the font to be used by the text. | |
void | setString (const char *st,...) |
Sets the text that will be rendered to the screen. | |
void | setCharPos (Gel2dVec position) |
Sets the position of the characters. | |
void | setCharRot (float deg) |
Sets the rotation of the characters. | |
void | setCharScl (Gel2dVec scale) |
Sets the scale of the characters. | |
void | skewChar (float sk) |
Skews the character. | |
void | setMaxLineLength (int len) |
Sets the maximum line length. | |
float | getMaxLineLength () const |
Gets the maximum line length. | |
float | getStringLength () |
Gets the length of the text's string. | |
float | getStringLength (const char *str) |
Gets the length of a specified string. | |
void | setCharSpacing (float dist) |
Sets the spacing between characters. | |
float | getCharSpacing () const |
Gets the spacing between characters. | |
void | setLineSpacing (float dist) |
Sets the spacing between lines of text. | |
float | getLineSpacing () const |
Gets the spacing between lines of text. | |
void | setAlignment (Alignment mode) |
Sets the text alignment mode. | |
Alignment | getAlignment () const |
Gets the text alignment mode. | |
void | setOrientation (Orientation mode) |
Sets the orientation of the text. | |
Orientation | getOrientation () const |
Gets the orientation of the text. | |
GelColor | getCol () const |
Gets the color of the text. | |
void | setCol (GelColor color) |
Sets the color of the text. | |
void | setRGB (float r, float g, float b) |
Sets the color of the text in RGB floats. | |
float | getAlpha () const |
Gets the transparency of the text. | |
void | setAlpha (float alpha) |
Sets the transparency of the text. | |
void | setTexture (GelTexture *tex) |
Sets the text's texture. | |
void | render () |
Renders the text to the screen. | |
Public Attributes | |
GelFontChar | fchar [256] |
Text object.
This class is used for printing text to the screen. It gets most of its character information from a GelFont object.
gel::GelText::GelText | ( | ) |
Default constructor.
gel::GelText::GelText | ( | GelFont * | fnt, |
const char * | st, | ||
... | |||
) |
Convenience constructor.
fnt | : A GelFont object. |
st | : The string. |
... | : Optional arguments list. |
Convenience constructor.
fnt | : A GelFont object. |
obj_pos | : The object's x and y coordinates. |
gel::GelText::~GelText | ( | ) |
Destructor.
GelFont* gel::GelText::getFont | ( | ) | const [inline] |
Gets the font associated with this text object.
void gel::GelText::setFont | ( | GelFont * | fnt | ) |
Sets the font to be used by the text.
fnt | : A GelFont object. |
void gel::GelText::setString | ( | const char * | st, |
... | |||
) |
Sets the text that will be rendered to the screen.
st | : The string. |
... | : Optional arguments list. |
void gel::GelText::setCharPos | ( | Gel2dVec | position | ) |
Sets the position of the characters.
void gel::GelText::setCharRot | ( | float | deg | ) |
Sets the rotation of the characters.
void gel::GelText::setCharScl | ( | Gel2dVec | scale | ) |
Sets the scale of the characters.
void gel::GelText::skewChar | ( | float | sk | ) | [inline] |
Skews the character.
This is a quick, handy way to italicize any font.
sk | : The amount of skew to apply to the characters, in pixels |
void gel::GelText::setMaxLineLength | ( | int | len | ) | [inline] |
Sets the maximum line length.
If the text string is longer than the maximum line length, it will start a new line below the previous one.
len | : The maximum line length in pixels. |
float gel::GelText::getMaxLineLength | ( | ) | const [inline] |
Gets the maximum line length.
float gel::GelText::getStringLength | ( | ) |
Gets the length of the text's string.
Depending on whether the orientation of the text is horizontal or vertical, it will return the length or height of the string, respectively.
float gel::GelText::getStringLength | ( | const char * | str | ) |
Gets the length of a specified string.
This function behaves the same as getStringLength().
str | : The string to get the length of. |
void gel::GelText::setCharSpacing | ( | float | dist | ) | [inline] |
Sets the spacing between characters.
dist | : The number of pixels the characters should be spaced apart. |
float gel::GelText::getCharSpacing | ( | ) | const [inline] |
Gets the spacing between characters.
void gel::GelText::setLineSpacing | ( | float | dist | ) | [inline] |
Sets the spacing between lines of text.
dist | : The number of pixels the lines of text should be spaced apart. |
float gel::GelText::getLineSpacing | ( | ) | const [inline] |
Gets the spacing between lines of text.
void gel::GelText::setAlignment | ( | Alignment | mode | ) | [inline] |
Sets the text alignment mode.
Alignment gel::GelText::getAlignment | ( | ) | const [inline] |
Gets the text alignment mode.
void gel::GelText::setOrientation | ( | Orientation | mode | ) | [inline] |
Sets the orientation of the text.
Orientation gel::GelText::getOrientation | ( | ) | const [inline] |
Gets the orientation of the text.
GelColor gel::GelText::getCol | ( | ) | const [inline] |
Gets the color of the text.
void gel::GelText::setCol | ( | GelColor | color | ) |
Sets the color of the text.
color | : The new color of the text. |
void gel::GelText::setRGB | ( | float | r, |
float | g, | ||
float | b | ||
) | [inline] |
Sets the color of the text in RGB floats.
r | : New red value. |
g | : New green value. |
b | : New blue value. |
float gel::GelText::getAlpha | ( | ) | const [inline] |
Gets the transparency of the text.
void gel::GelText::setAlpha | ( | float | alpha | ) | [inline] |
Sets the transparency of the text.
It should be in range from 0 (transparent) to 1 (opaque).
alpha | : The new alpha value. |
void gel::GelText::setTexture | ( | GelTexture * | tex | ) |
Sets the text's texture.
tex | : The text's new texture. |
void gel::GelText::render | ( | ) | [virtual] |
Renders the text to the screen.
Reimplemented from gel::GelObject.
API Documentation by Mark D. Procarione | Generated by |