Raylib C++  1.0.0
Encapsulates the raylib library
Public Member Functions | List of all members
raylib::text::RlText Class Reference

Encapsulation of the raylib text. More...

#include <RlText.hpp>

Collaboration diagram for raylib::text::RlText:
Collaboration graph

Public Member Functions

 RlText (const std::string &text, const Vector2f &position={0, 0}, const RlColor &color=RlColor::Black)
 RlText constructor (default font used) More...
 
 RlText (const std::string &text, std::shared_ptr< RlFont > &font, const Vector2f &position={0, 0}, const RlColor &color=RlColor::Black)
 RlText constructor. More...
 
 RlText (const std::string &text, const std::string &fontPath, float fontSize=20, const Vector2f &position={0, 0}, const RlColor &color=RlColor::Black)
 RlText constructor. More...
 
void setText (const std::string &text)
 Set the text to use. More...
 
void setFont (const std::shared_ptr< RlFont > &font)
 Set the font to use. More...
 
void setPosition (float x, float y)
 Set the position of the text. More...
 
void setPosition (const Vector2f &pos)
 Set the position of the text. More...
 
void setColor (const RlColor &color)
 Set the color of the text. More...
 
const std::string & getText () const
 Get the text. More...
 
const std::shared_ptr< RlFont > & getFont () const
 Get the font. More...
 
const Vector2fgetPosition () const
 Get the position of the text. More...
 
const RlColorgetColor () const
 Get the color of the text. More...
 
float getWidth () const
 Get the width of the text with the loaded font. More...
 
float getTextSpacing () const
 Get the text spacing. More...
 
Vector2f getSize () const
 Get the size of the text with the loaded font. More...
 
void setTextSpacing (float textSpacing)
 Set the text spacing. More...
 
float getFontSize () const
 Get the height of the text with the loaded font. More...
 
void setFontSize (float fontSize)
 Set the font size. More...
 
void setRotation (float rotation)
 Set the text rotation. More...
 
float getRotation () const
 Get the text rotation. More...
 
const Vector2fgetOrigin () const
 Get the text origin. More...
 
void setOrigin (const Vector2f &origin)
 Set the text origin. More...
 

Detailed Description

Encapsulation of the raylib text.

Constructor & Destructor Documentation

◆ RlText() [1/3]

raylib::text::RlText::RlText ( const std::string &  text,
const Vector2f position = {0, 0},
const RlColor color = RlColor::Black 
)
explicit

RlText constructor (default font used)

Parameters
textthe text to use
positionthe position of the text
colorthe color of the text
Here is the call graph for this function:

◆ RlText() [2/3]

raylib::text::RlText::RlText ( const std::string &  text,
std::shared_ptr< RlFont > &  font,
const Vector2f position = {0, 0},
const RlColor color = RlColor::Black 
)
explicit

RlText constructor.

Parameters
textthe text to use
fontthe font to use
positionthe position of the text
colorthe color of the text

◆ RlText() [3/3]

raylib::text::RlText::RlText ( const std::string &  text,
const std::string &  fontPath,
float  fontSize = 20,
const Vector2f position = {0, 0},
const RlColor color = RlColor::Black 
)
explicit

RlText constructor.

Parameters
textthe text to use
fontPaththe path to the font to use
fontSizethe size of the font to use
positionthe position of the text
colorthe color of the text

Member Function Documentation

◆ getColor()

const RlColor & raylib::text::RlText::getColor ( ) const

Get the color of the text.

Returns
the color of the text
Here is the caller graph for this function:

◆ getFont()

const std::shared_ptr< raylib::text::RlFont > & raylib::text::RlText::getFont ( ) const

Get the font.

Returns
the font
Here is the caller graph for this function:

◆ getFontSize()

float raylib::text::RlText::getFontSize ( ) const

Get the height of the text with the loaded font.

Returns
the height of the text
Here is the caller graph for this function:

◆ getOrigin()

const Vector2f & raylib::text::RlText::getOrigin ( ) const

Get the text origin.

Returns
the text origin
Here is the caller graph for this function:

◆ getPosition()

const Vector2f & raylib::text::RlText::getPosition ( ) const

Get the position of the text.

Returns
the position of the text
Here is the caller graph for this function:

◆ getRotation()

float raylib::text::RlText::getRotation ( ) const

Get the text rotation.

Returns
the text rotation
Here is the caller graph for this function:

◆ getSize()

Vector2f raylib::text::RlText::getSize ( ) const

Get the size of the text with the loaded font.

Returns
the size of the text
Here is the call graph for this function:

◆ getText()

const std::string & raylib::text::RlText::getText ( ) const

Get the text.

Returns
the text
Here is the caller graph for this function:

◆ getTextSpacing()

float raylib::text::RlText::getTextSpacing ( ) const

Get the text spacing.

Here is the caller graph for this function:

◆ getWidth()

float raylib::text::RlText::getWidth ( ) const

Get the width of the text with the loaded font.

Returns
the width of the text
Deprecated:
Use RlText::getSize() instead

◆ setColor()

void raylib::text::RlText::setColor ( const RlColor color)

Set the color of the text.

Parameters
colorthe color of the text

◆ setFont()

void raylib::text::RlText::setFont ( const std::shared_ptr< RlFont > &  font)

Set the font to use.

Parameters
fontthe font to use

◆ setFontSize()

void raylib::text::RlText::setFontSize ( float  fontSize)

Set the font size.

Parameters
fontSizethe font size
Attention
Use this only if you know what you are doing (aka using the default font)
Here is the caller graph for this function:

◆ setOrigin()

void raylib::text::RlText::setOrigin ( const Vector2f origin)

Set the text origin.

Parameters
originthe text origin
Here is the caller graph for this function:

◆ setPosition() [1/2]

void raylib::text::RlText::setPosition ( const Vector2f pos)

Set the position of the text.

Parameters
posthe position of the text

◆ setPosition() [2/2]

void raylib::text::RlText::setPosition ( float  x,
float  y 
)

Set the position of the text.

Parameters
xthe x position
ythe position of the text

◆ setRotation()

void raylib::text::RlText::setRotation ( float  rotation)

Set the text rotation.

Parameters
rotationthe text rotation
Here is the caller graph for this function:

◆ setText()

void raylib::text::RlText::setText ( const std::string &  text)

Set the text to use.

Parameters
textthe text to use

◆ setTextSpacing()

void raylib::text::RlText::setTextSpacing ( float  textSpacing)

Set the text spacing.

Parameters
textSpacing
Here is the caller graph for this function:

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