ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
asw::game::Text Class Reference

Text Object. More...

#include <game.h>

Inheritance diagram for asw::game::Text:
[legend]
Collaboration diagram for asw::game::Text:
[legend]

Public Member Functions

void set_font (const asw::Font &font)
 Set the font of the text.
 
void set_text (const std::string_view &text)
 Set the text of the text object.
 
void set_color (const asw::Color &color)
 Set the color of the text.
 
void set_justify (asw::TextJustify justify)
 Set the justification of the text.
 
void draw () override
 Draw the text to the screen.
 
- Public Member Functions inherited from asw::game::GameObject
 GameObject ()=default
 
virtual ~GameObject ()=default
 
virtual void update (float dt)
 Update the object.
 
const asw::Quad< float > & get_transform () const
 Get transform.
 

Private Attributes

std::string text_
 
asw::Font font_
 
asw::Color color_
 
asw::TextJustify justify_ { asw::TextJustify::Left }
 

Additional Inherited Members

- Public Attributes inherited from asw::game::GameObject
asw::Quad< float > transform
 The transform of the object.
 
float rotation { 0.0F }
 The rotation of the object in radians.
 
int z_index { 0 }
 The layer that the object is on.
 
bool active { true }
 Whether or not the object is active.
 
float alpha { 1.0F }
 Opacity of the object.
 
Physics body
 Physics body of the object.
 
bool alive { true }
 Alive state.
 

Detailed Description

Text Object.

Definition at line 159 of file game.h.

Member Function Documentation

◆ draw()

void asw::game::Text::draw ( )
inlineoverridevirtual

Draw the text to the screen.

Reimplemented from asw::game::GameObject.

Definition at line 199 of file game.h.

◆ set_color()

void asw::game::Text::set_color ( const asw::Color & color)
inline

Set the color of the text.

Parameters
colorThe color to set.

Definition at line 183 of file game.h.

◆ set_font()

void asw::game::Text::set_font ( const asw::Font & font)
inline

Set the font of the text.

Parameters
fontThe font to set.

Definition at line 165 of file game.h.

◆ set_justify()

void asw::game::Text::set_justify ( asw::TextJustify justify)
inline

Set the justification of the text.

Parameters
justifyThe justification to set.

Definition at line 192 of file game.h.

◆ set_text()

void asw::game::Text::set_text ( const std::string_view & text)
inline

Set the text of the text object.

Parameters
textThe text to set.

Definition at line 174 of file game.h.

Member Data Documentation

◆ color_

asw::Color asw::game::Text::color_
private

Definition at line 207 of file game.h.

◆ font_

asw::Font asw::game::Text::font_
private

Definition at line 206 of file game.h.

◆ justify_

asw::TextJustify asw::game::Text::justify_ { asw::TextJustify::Left }
private

Definition at line 208 of file game.h.

◆ text_

std::string asw::game::Text::text_
private

Definition at line 205 of file game.h.


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