TinyLib 0.1.1
Loading...
Searching...
No Matches
tl::Text Class Reference

#include <Text.h>

Inheritance diagram for tl::Text:
tl::Drawable

Public Member Functions

 Text (String="", u32=12, Vec2i={0, 0})
 Create a new text that can be drawn to screen.
 
 ~Text ()
 Clean up string data.
 
void setString (String)
 Set the string data.
 
String getString () const
 Get the string data from this text.
 
void setFontSize (s32)
 Set the font size for this text.
 
- Public Member Functions inherited from tl::Drawable
 Drawable (Vec4i bounds={0, 0, 0, 0})
 Creates a new drawable object with it's position and size.
 
 ~Drawable ()
 Nothing to clean up for now.
 
void setPosition (Vec2i)
 Set position of this drawable object.
 
void setSize (Vec2i)
 Set size of this drawable object.
 
Vec2i getPosition () const
 Get the current position of this drawable object.
 
Vec2i getSize () const
 Get the current size of this drawable object.
 
Color getColor () const
 Get the current color of this drawable object.
 
void move (Vec2i)
 Move this drawable object from current position.
 
void setColor (Color)
 Set the color of this drawable object.
 
bit intersects (Drawable &) const
 Check if this drawable is intersecting with another.
 
bit intersects (Window &) const
 Check if this drawable is inside the window.
 

Additional Inherited Members

- Protected Attributes inherited from tl::Drawable
s32 posX
 
s32 posY
 
s32 sizeX
 
s32 sizeY
 
u8 r = 0
 
u8 g = 0
 
u8 b = 0
 
u8 a = 0
 

Detailed Description

Definition at line 8 of file Text.h.

Constructor & Destructor Documentation

◆ Text()

tl::Text::Text ( String str = "",
u32 fontSize = 12,
Vec2i pos = {0, 0} )

Create a new text that can be drawn to screen.

Parameters
strWhat the text displays.
fontSizeHow big text is.
posWhere text is.

The defaults for each parameter, no string data, fonst size 12, position (0, 0).

Definition at line 13 of file Text.cpp.

◆ ~Text()

tl::Text::~Text ( )

Clean up string data.

Definition at line 22 of file Text.cpp.

Member Function Documentation

◆ getString()

String tl::Text::getString ( ) const

Get the string data from this text.

Returns
Internal string.

Definition at line 37 of file Text.cpp.

◆ setFontSize()

void tl::Text::setFontSize ( s32 size)

Set the font size for this text.

Parameters
sizeNew font size.

I might change how font size scales later on, it doesn't seem to be accurate based on pixels when using GDI/DirectX.

Definition at line 48 of file Text.cpp.

◆ setString()

void tl::Text::setString ( String str)

Set the string data.

Parameters
strNew string for text.

Definition at line 29 of file Text.cpp.


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