overview wiki api reference download
 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:
gameplay::Ref gameplay::Drawable gameplay::AnimationTarget

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 RectanglegetClip () const
void setOpacity (float opacity)
float getOpacity () const
void setColor (const Vector4 &color)
const Vector4getColor () const
unsigned int draw (bool wireframe=false)

Static Public Member Functions

static Textcreate (const char *fontPath, const char *str, const Vector4 &color=Vector4::one(), unsigned int size=0)
static Textcreate (Properties *properties)

Static Public Attributes

static const int ANIMATE_OPACITY = 1
static const int ANIMATE_COLOR = 2

Protected Member Functions

 Text ()
 ~Text ()
Textoperator= (const Text &text)
Drawableclone (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:
fontPathThe font path.
strThe text string to draw.
colorThe text color.
sizeThe 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:
propertiesThe 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]
void gameplay::Text::getAnimationPropertyValue ( int  propertyId,
AnimationValue value 
) [protected, virtual]
See also:
AnimationTarget::getAnimationProperty

Implements gameplay::AnimationTarget.

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.

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.

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]

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:
clipThe clipping region for this text.
void gameplay::Text::setColor ( const Vector4 color)

Sets the color (RGBA) for the sprite.

Parameters:
colorThe color(RGBA) for the sprite.
void gameplay::Text::setHeight ( float  height)

Set the height of text to be drawn within.

Parameters:
heightThe height to draw the text.

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

Parameters:
alignThe 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:
opacityThe opacity for the sprite.
void gameplay::Text::setRightToLeft ( bool  rightToLeft)

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

Parameters:
rightToLefttrue 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:
strThe text string to be drawn.
void gameplay::Text::setWidth ( float  width)

Set the width to draw the text within.

Parameters:
widthThe width to draw the text.
void gameplay::Text::setWrap ( bool  wrap)

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

Parameters:
wraptrue 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