|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
gameplay::Text Class Reference

`#include <Text.h>`

Inheritance diagram for gameplay::Text:

List of all members.

## 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)

## Detailed Description

Defines a text block of characters to be drawn.

Text can be attached to a node.

## Constructor & Destructor Documentation

gameplay::Text::Text | ( |  | ) | `[protected]`

Constructor

gameplay::Text::~Text | ( |  | ) | `[protected]`

Destructor

## Member Function Documentation

Drawable* gameplay::Text::clone | ( | NodeCloneContext & | context | ) | `[protected, virtual]`

See also:
  Drawable::clone

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.

Parameters:

  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).

Returns:
  A Text object.

static Text* gameplay::Text::create | ( | Properties * | properties | ) | `[static]`

Creates text from a properties object.

Parameters:

  properties | The properties object to load from.

Returns:
  The tile set created.

unsigned int gameplay::Text::draw | ( | bool | wireframe = `false` | ) | `[virtual]`

See also:
  Drawable::draw

Implements gameplay::Drawable.

unsigned int gameplay::Text::getAnimationPropertyComponentCount | ( | int | propertyId | ) | const`[protected, virtual]`

See also:
  AnimationTarget::getAnimationPropertyComponentCount

Implements gameplay::AnimationTarget.

void gameplay::Text::getAnimationPropertyValue | ( | int | propertyId,
|  | AnimationValue * | value
| ) |  | `[protected, virtual]`

See also:
  AnimationTarget::getAnimationProperty

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.

Returns:
  clip The clipping region for this text.

const Vector4& gameplay::Text::getColor | ( |  | ) | const

Gets the color (RGBA) for the sprite.

Returns:
  The color(RGBA) for the sprite.

float gameplay::Text::getHeight | ( |  | ) | const

Gets the width of the text.

Returns:
  The overall width of the text.

Font::Justify gameplay::Text::getJustify | ( |  | ) | const

Gets the justification to align the text within the text bounds.

Returns:
  The text justification alignment.

float gameplay::Text::getOpacity | ( |  | ) | const

Gets the opacity for the sprite.

The range is from full transparent to opaque [0.0,1.0].

Returns:
  The opacity for the sprite.

int gameplay::Text::getPropertyId | ( | TargetType | type,
|  | const char * | propertyIdStr
| ) |  | `[protected, virtual]`

See also:
  AnimationTarget::getPropertyId

Reimplemented from gameplay::AnimationTarget.

bool gameplay::Text::getRightToLeft | ( |  | ) | const

Sets if the text is rendered right-to-left.

Default is false (left-to-right)

Returns:
  rightToLeft true if the text is rendered right-to-left, false if left-to-right.

unsigned int gameplay::Text::getSize | ( |  | ) | const

Gets the size of the text to be drawn.

Returns:
  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.

Returns:
  The text string to be drawn.

float gameplay::Text::getWidth | ( |  | ) | const

Gets the width of the text.

Returns:
  The width of the text.

bool gameplay::Text::getWrap | ( |  | ) | const

Gets if the the text is wrapped by the text width.

Default is true.

Returns:
  true if the the text is wrapped by the text width.

Text& gameplay::Text::operator= | ( | const Text & | text | ) | `[protected]`

operator=

void gameplay::Text::setAnimationPropertyValue | ( | int | propertyId,
|  | AnimationValue * | value,
|  | float | blendWeight = `1.0f`
| ) |  | `[protected, virtual]`

See also:
  AnimationTarget::setAnimationProperty

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.

Parameters:

  clip | The clipping region for this text.

void gameplay::Text::setColor | ( | const Vector4 & | color | ) |

Sets the color (RGBA) for the sprite.

Parameters:

  color | The color(RGBA) for the sprite.

void gameplay::Text::setHeight | ( | float | height | ) |

Set the height of text to be drawn within.

Parameters:

  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.

Parameters:

  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].

Parameters:

  opacity | The opacity for the sprite.

void gameplay::Text::setRightToLeft | ( | bool | rightToLeft | ) |

Sets if the text is rendered right-to-left.

Parameters:

  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.

Parameters:

  str | The text string to be drawn.

void gameplay::Text::setWidth | ( | float | width | ) |

Set the width to draw the text within.

Parameters:

  width | The width to draw the text.

void gameplay::Text::setWrap | ( | bool | wrap | ) |

Sets if the the text is wrapped by the text width.

Parameters:

  wrap | true if the the text is wrapped by the text width.

## Member Data Documentation

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

All Classes Functions Variables Typedefs Enumerations Enumerator