Dualie
Loading...
Searching...
No Matches
dl::Text Class Reference

A class used to handle the transformation and drawing of visible text. More...

#include <Text.hpp>

Inheritance diagram for dl::Text:
Collaboration diagram for dl::Text:

Public Member Functions

 Text (const dl::TextBuffer &textBuffer)
 
void updateDynamicText ()
 reparses and reoptimizes the text. This should be used if you call TextBuffer::flushBuffer beforehand.
 
void setString (std::string str)
 Sets the text's string.
 
void setScale (const dl::Vector2f &scale)
 Sets the scale of the text.
 
void setAlignment (TextAlignment alignment)
 Sets the alignment of the text.
 
void setOrigin (const dl::Vector2f &origin)
 Sets the origin of the shape. The default origin is (0,0) and is the top left pixel of the shape bounds. Setting the origin can affect where the shape is drawn. For instance, setting the origin to be half the shape size will cause the shape to be centered on its position.
 
void setOrigin (float x, float y)
 Sets the origin of the shape. The default origin is (0,0) and is the top left pixel of the shape bounds. Setting the origin can affect where the shape is drawn. For instance, setting the origin to be half the shape size will cause the shape to be centered on its position.
 
void setColor (const dl::Color &color)
 Sets the color of the text.
 
const std::string & getString ()
 
const dl::Vector2fgetOrigin ()
 
const dl::Vector2fgetScale ()
 
void draw (const dl::Vector2f &viewOffset) override
 Draws the drawable to the screen.
 
- Public Member Functions inherited from dl::Transformable
virtual void setPosition (const dl::Vector2f &position)
 Sets the position of the transformable.
 
void setPosition (float x, float y)
 Sets the position of the transformable.
 
virtual void move (const dl::Vector2f &offset)
 Moves the transformable offset number of pixels.
 
void move (float xOffset, float yOffset)
 Moves the transformable offset number of pixels.
 
const dl::Vector2fgetPosition () const
 
- Public Member Functions inherited from dl::Drawable
void viewShouldAffect (bool effective)
 Set whether the current view should affect the position of the drawable. Otherwise, its position on the screen will be absolute.
 
void setDepth (float depth)
 Sets the depth of the drawable for 3d. This simply corresponds to the X offset calculated for the 2 separate top screens. Larger objects will require a deeper depth for the 3d effect to be noticable. A positive value will cause the drawable to sink into the screen, while a negative value will cause it to pop out.
 
const float & getDepth () const
 

Additional Inherited Members

- Protected Attributes inherited from dl::Transformable
dl::Vector2f m_position
 
- Protected Attributes inherited from dl::Drawable
bool m_bViewDoesAffect = true
 
float m_depth = 0.0f
 

Detailed Description

A class used to handle the transformation and drawing of visible text.

Member Function Documentation

◆ draw()

void dl::Text::draw ( const dl::Vector2f & viewOffset)
overridevirtual

Draws the drawable to the screen.

Parameters
viewOffsetThe offset of the current view to be used for internal drawable positioning

Implements dl::Drawable.

◆ getOrigin()

const dl::Vector2f & dl::Text::getOrigin ( )
Returns
the origin in pixels

◆ getScale()

const dl::Vector2f & dl::Text::getScale ( )
Returns
the scale in pixels

◆ getString()

const std::string & dl::Text::getString ( )
Returns
The text's string

◆ setAlignment()

void dl::Text::setAlignment ( dl::TextAlignment alignment)

Sets the alignment of the text.

Parameters
scaleThe alignment to set

◆ setColor()

void dl::Text::setColor ( const dl::Color & color)

Sets the color of the text.

Parameters
colorThe color to set;

◆ setOrigin() [1/2]

void dl::Text::setOrigin ( const dl::Vector2f & origin)

Sets the origin of the shape. The default origin is (0,0) and is the top left pixel of the shape bounds. Setting the origin can affect where the shape is drawn. For instance, setting the origin to be half the shape size will cause the shape to be centered on its position.

Parameters
originThe origin in pixels

◆ setOrigin() [2/2]

void dl::Text::setOrigin ( float x,
float y )

Sets the origin of the shape. The default origin is (0,0) and is the top left pixel of the shape bounds. Setting the origin can affect where the shape is drawn. For instance, setting the origin to be half the shape size will cause the shape to be centered on its position.

Parameters
xThe origin in pixels (X)
yThe origin in pixels (Y)

◆ setScale()

void dl::Text::setScale ( const dl::Vector2f & scale)

Sets the scale of the text.

Parameters
scaleThe scale to set

◆ setString()

void dl::Text::setString ( std::string str)

Sets the text's string.

Parameters
strThe string to set

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