hx3d  1
2D/3D Simple Game Framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
hx3d::gui::Text Class Reference

Text GUI element. More...

#include <text.hpp>

Public Member Functions

 Text ()
 Create a text without font. See setFont.
 
 Text (Ptr< Font > font)
 Create a text from a font. More...
 
 Text (Widget *parent, Ptr< Font > font)
 Create a text from a parent widget and a font. More...
 
void setFont (Ptr< Font > font)
 Set the font. More...
 
void setCharacterSize (int size)
 Set the character size. More...
 
void setCenterAlignment (bool value)
 Set the center alignment. More...
 
void setContent (std::string content)
 Set the text content. More...
 
void functionDraw (Ptr< Shader > shader, math::Function function)
 Draw the text following a function. More...
 
Ptr< Font > getFont ()
 Get the text font. More...
 
int getCharacterSize ()
 Get the character size. More...
 
float getLength ()
 Get the text length. More...
 
bool isCenterAligned ()
 Is the text center aligned ? More...
 
- Public Member Functions inherited from hx3d::gui::Widget
 Widget (Widget *parent)
 Construct a widget from a parent widget. More...
 
void add (Ptr< Widget > widget)
 Add a widget to the list. More...
 
- Public Member Functions inherited from hx3d::graphics::Mesh
virtual void draw (Ptr< Shader > shader)
 Draw the mesh using a shader. More...
 
void setTint (Color tint)
 Set the mesh tint. More...
 
ColorgetTint ()
 Get the mesh tint. More...
 
void updateColor ()
 Update the mesh color from the tint.
 
void setGeometry (Ptr< geom::BaseGeometry > geometry)
 Set the mesh geometry. More...
 
Ptr< geom::BaseGeometry > & getGeometry ()
 Get the mesh geometry. More...
 

Protected Member Functions

void init ()
 Initialize the text.
 
float calculateLength ()
 Calculate the text length.
 

Protected Attributes

Ptr< Font > _font
 Text font.
 
std::string _content
 Text content.
 
float _length
 Text length.
 
int _characterSize
 Character size.
 
bool _centerAligned
 Is the text center aligned ?
 
- Protected Attributes inherited from hx3d::graphics::Mesh
Color _tint
 Tint color.
 
Ptr< geom::BaseGeometry_geometry
 Current geometry.
 

Additional Inherited Members

- Public Attributes inherited from hx3d::graphics::Mesh
Transform transform
 Mesh transformation.
 

Detailed Description

Text GUI element.

Definition at line 37 of file text.hpp.

Constructor & Destructor Documentation

hx3d::gui::Text::Text ( Ptr< Font >  font)

Create a text from a font.

Parameters
fontFont (Ptr)

Definition at line 37 of file text.cpp.

hx3d::gui::Text::Text ( Widget parent,
Ptr< Font >  font 
)

Create a text from a parent widget and a font.

Parameters
parentWidget (Ptr)
fontFont (Ptr)

Definition at line 40 of file text.cpp.

Member Function Documentation

void hx3d::gui::Text::functionDraw ( Ptr< Shader >  shader,
math::Function  function 
)

Draw the text following a function.

Parameters
shaderShader (Ptr)
functionFunction

Definition at line 162 of file text.cpp.

int hx3d::gui::Text::getCharacterSize ( )

Get the character size.

Returns
Character size

Definition at line 74 of file text.cpp.

Ptr< Font > hx3d::gui::Text::getFont ( )

Get the text font.

Returns
Font (Ptr)

Definition at line 70 of file text.cpp.

float hx3d::gui::Text::getLength ( )

Get the text length.

Returns
Text length

Definition at line 78 of file text.cpp.

bool hx3d::gui::Text::isCenterAligned ( )

Is the text center aligned ?

Returns
True/False

Definition at line 86 of file text.cpp.

void hx3d::gui::Text::setCenterAlignment ( bool  value)

Set the center alignment.

Parameters
valueTrue/False

Definition at line 82 of file text.cpp.

void hx3d::gui::Text::setCharacterSize ( int  size)

Set the character size.

Parameters
sizeSize

Definition at line 60 of file text.cpp.

void hx3d::gui::Text::setContent ( std::string  content)

Set the text content.

Parameters
contentContent

Definition at line 65 of file text.cpp.

void hx3d::gui::Text::setFont ( Ptr< Font >  font)

Set the font.

Parameters
fontFont (Ptr)

Definition at line 54 of file text.cpp.


The documentation for this class was generated from the following files: