#include <Text.h>
Public Member Functions | |
void | setText (const char *str) |
const char * | getText () const |
unsigned int | getSize () const |
void | setWidth (float width) |
float | getWidth () const |
void | setHeight (float height) |
float | getHeight () const |
void | setWrap (bool wrap) |
bool | getWrap () const |
void | setRightToLeft (bool rightToLeft) |
bool | getRightToLeft () const |
void | setJustify (Font::Justify align) |
Font::Justify | getJustify () const |
void | setClip (const Rectangle &clip) |
const Rectangle & | getClip () const |
void | setOpacity (float opacity) |
float | getOpacity () const |
void | setColor (const Vector4 &color) |
const Vector4 & | getColor () const |
unsigned int | draw (bool wireframe=false) |
Static Public Member Functions | |
static Text * | create (const char *fontPath, const char *str, const Vector4 &color=Vector4::one(), unsigned int size=0) |
static Text * | create (Properties *properties) |
Static Public Attributes | |
static const int | ANIMATE_OPACITY = 1 |
static const int | ANIMATE_COLOR = 2 |
Protected Member Functions | |
Text () | |
~Text () | |
Text & | operator= (const Text &text) |
Drawable * | clone (NodeCloneContext &context) |
int | getPropertyId (TargetType type, const char *propertyIdStr) |
unsigned int | getAnimationPropertyComponentCount (int propertyId) const |
void | getAnimationPropertyValue (int propertyId, AnimationValue *value) |
void | setAnimationPropertyValue (int propertyId, AnimationValue *value, float blendWeight=1.0f) |
Defines a text block of characters to be drawn.
Text can be attached to a node.
gameplay::Text::Text | ( | ) | [protected] |
Constructor
gameplay::Text::~Text | ( | ) | [protected] |
Destructor
Drawable* gameplay::Text::clone | ( | NodeCloneContext & | context | ) | [protected, virtual] |
Implements gameplay::Drawable.
static Text* gameplay::Text::create | ( | const char * | fontPath, |
const char * | str, | ||
const Vector4 & | color = Vector4::one() , |
||
unsigned int | size = 0 |
||
) | [static] |
Creates a Text object from a given string. Vertex coordinates, UVs and indices will be computed and stored in the Text object. For static text labels that do not change frequently, this means these computations need not be performed every frame.
fontPath | The font path. |
str | The text string to draw. |
color | The text color. |
size | The font size to draw text (0 for default font size). |
static Text* gameplay::Text::create | ( | Properties * | properties | ) | [static] |
Creates text from a properties object.
properties | The properties object to load from. |
unsigned int gameplay::Text::draw | ( | bool | wireframe = false | ) | [virtual] |
Implements gameplay::Drawable.
unsigned int gameplay::Text::getAnimationPropertyComponentCount | ( | int | propertyId | ) | const [protected, virtual] |
Implements gameplay::AnimationTarget.
void gameplay::Text::getAnimationPropertyValue | ( | int | propertyId, |
AnimationValue * | value | ||
) | [protected, virtual] |
Implements gameplay::AnimationTarget.
const Rectangle& gameplay::Text::getClip | ( | ) | const |
Gets the local clipping region for this text.
This is used for clipping unwanted regions of text.
Default is Rectangle(0, 0, 0, 0) which means no clipping region is applied.
const Vector4& gameplay::Text::getColor | ( | ) | const |
Gets the color (RGBA) for the sprite.
float gameplay::Text::getHeight | ( | ) | const |
Gets the width of the text.
Font::Justify gameplay::Text::getJustify | ( | ) | const |
Gets the justification to align the text within the text bounds.
float gameplay::Text::getOpacity | ( | ) | const |
Gets the opacity for the sprite.
The range is from full transparent to opaque [0.0,1.0].
int gameplay::Text::getPropertyId | ( | TargetType | type, |
const char * | propertyIdStr | ||
) | [protected, virtual] |
Reimplemented from gameplay::AnimationTarget.
bool gameplay::Text::getRightToLeft | ( | ) | const |
Sets if the text is rendered right-to-left.
Default is false (left-to-right)
unsigned int gameplay::Text::getSize | ( | ) | const |
Gets the size of the text to be drawn.
const char* gameplay::Text::getText | ( | ) | const |
Get the string that will be drawn from this Text object.
float gameplay::Text::getWidth | ( | ) | const |
Gets the width of the text.
bool gameplay::Text::getWrap | ( | ) | const |
Gets if the the text is wrapped by the text width.
Default is true.
void gameplay::Text::setAnimationPropertyValue | ( | int | propertyId, |
AnimationValue * | value, | ||
float | blendWeight = 1.0f |
||
) | [protected, virtual] |
Implements gameplay::AnimationTarget.
void gameplay::Text::setClip | ( | const Rectangle & | clip | ) |
Sets the local clipping region for this text.
This is used for clipping unwanted regions of text.
clip | The clipping region for this text. |
void gameplay::Text::setColor | ( | const Vector4 & | color | ) |
Sets the color (RGBA) for the sprite.
color | The color(RGBA) for the sprite. |
void gameplay::Text::setHeight | ( | float | height | ) |
Set the height of text to be drawn within.
height | The height to draw the text. |
void gameplay::Text::setJustify | ( | Font::Justify | align | ) |
Sets the justification to align the text within the text bounds.
align | The text justification alignment. |
void gameplay::Text::setOpacity | ( | float | opacity | ) |
Sets the opacity for the sprite.
The range is from full transparent to opaque [0.0,1.0].
opacity | The opacity for the sprite. |
void gameplay::Text::setRightToLeft | ( | bool | rightToLeft | ) |
Sets if the text is rendered right-to-left.
rightToLeft | true if the text is rendered right-to-left, false if left-to-right. |
void gameplay::Text::setText | ( | const char * | str | ) |
Sets the text to be drawn.
str | The text string to be drawn. |
void gameplay::Text::setWidth | ( | float | width | ) |
Set the width to draw the text within.
width | The width to draw the text. |
void gameplay::Text::setWrap | ( | bool | wrap | ) |
Sets if the the text is wrapped by the text width.
wrap | true if the the text is wrapped by the text width. |
const int gameplay::Text::ANIMATE_COLOR = 2 [static] |
Color property. Data = red, green, blue, alpha
const int gameplay::Text::ANIMATE_OPACITY = 1 [static] |
Opacity property. Data=opacity