Level H Engine
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Text Class Reference

Creates a Text sprite for use with using the Text formating. More...

#include <Text.h>

Collaboration diagram for Text:
Collaboration graph

Public Member Functions

 Text (std::string text, std::string fontLocation)
 Constructs the Text Texture. Font size and colour will be default (size 10 and black). More...
 
 Text (std::string text, std::string fontLocation, int fontSize)
 Constructs the Text Texture. Font colour will be default (black). More...
 
 Text (std::string text, std::string fontLocation, int r, int g, int b)
 Constructs the Text Texture. Font size will be default (size 10). More...
 
 Text (std::string text, std::string fontLocation, SDL_Colour fontColour)
 Constructs the Text Texture. Font size will be default (size 10). More...
 
 Text (std::string text, std::string fontLocation, int fontSize, int r, int g, int b)
 Constructs the Text Texture. More...
 
 Text (std::string text, std::string fontLocation, int fontSize, SDL_Colour fontColour)
 Constructs the Text Texture. More...
 
 ~Text ()
 Destructs the Text Texture. More...
 
void pushToScreen (Vec2 pos)
 Pushes the Text Texture to the screen to the XY Coordinates. More...
 
void setColour (int r, int g, int b)
 Sets the colour of the text. More...
 
void setColour (SDL_Colour colour)
 Sets the colour of the text. More...
 
void setFontSize (int inSize)
 Sets the font size of the text. More...
 
void setFont (std::string inFontLocation)
 Sets the font of the text. More...
 
void setText (std::string inText)
 Sets the text. More...
 
Vec2 getDimensions ()
 Gets the dimensions of the Text Texture. More...
 

Private Member Functions

void createTextTexture ()
 Creates a Text Texture using the Text data. More...
 

Private Attributes

TTF_Font * font
 Font. More...
 
SDL_Colour fontColour
 Font colour. More...
 
SpritesurfaceData
 The surface sprite. More...
 
int fontSize
 Font size. More...
 
std::string text
 The text and font location. More...
 
std::string fontLocation
 
Vec2 dimensions
 The Texture dimensions. More...
 

Detailed Description

Creates a Text sprite for use with using the Text formating.

Constructor & Destructor Documentation

◆ Text() [1/6]

Text::Text ( std::string  text,
std::string  fontLocation 
)

Constructs the Text Texture. Font size and colour will be default (size 10 and black).

Parameters
textThe text to display.
fontLocationThe location of the font file.
Here is the call graph for this function:

◆ Text() [2/6]

Text::Text ( std::string  text,
std::string  fontLocation,
int  fontSize 
)

Constructs the Text Texture. Font colour will be default (black).

Parameters
textThe text to display.
fontLocationThe location of the font file.
fontSizeThe size of the font.
Here is the call graph for this function:

◆ Text() [3/6]

Text::Text ( std::string  text,
std::string  fontLocation,
int  r,
int  g,
int  b 
)

Constructs the Text Texture. Font size will be default (size 10).

Parameters
textThe text to display.
fontLocationThe location of the font file.
rThe value of red. (0-255)
gThe value of green. (0-255)
bThe value of blue. (0-255)
Here is the call graph for this function:

◆ Text() [4/6]

Text::Text ( std::string  text,
std::string  fontLocation,
SDL_Colour  fontColour 
)

Constructs the Text Texture. Font size will be default (size 10).

Parameters
textThe text to display.
fontLocationThe location of the font file.
fontColourThe colour of the font.
Here is the call graph for this function:

◆ Text() [5/6]

Text::Text ( std::string  text,
std::string  fontLocation,
int  fontSize,
int  r,
int  g,
int  b 
)

Constructs the Text Texture.

Parameters
textThe text to display.
fontLocationThe location of the font file.
fontSizeThe size of the font.
rThe value of red. (0-255)
gThe value of green. (0-255)
bThe value of blue. (0-255)
Here is the call graph for this function:

◆ Text() [6/6]

Text::Text ( std::string  text,
std::string  fontLocation,
int  fontSize,
SDL_Colour  fontColour 
)

Constructs the Text Texture.

Parameters
textThe text to display.
fontLocationThe location of the font file.
fontSizeThe size of the font.
fontColourThe colour of the font.
Here is the call graph for this function:

◆ ~Text()

Text::~Text ( )

Destructs the Text Texture.

Member Function Documentation

◆ createTextTexture()

void Text::createTextTexture ( )
private

Creates a Text Texture using the Text data.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDimensions()

Vec2 Text::getDimensions ( )

Gets the dimensions of the Text Texture.

Returns
The dimensions of the Text Texture.

◆ pushToScreen()

void Text::pushToScreen ( Vec2  pos)

Pushes the Text Texture to the screen to the XY Coordinates.

Parameters
posThe position to push the Text Texture to.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setColour() [1/2]

void Text::setColour ( int  r,
int  g,
int  b 
)

Sets the colour of the text.

Parameters
rThe value of red. (0-255)
gThe value of green. (0-255)
bThe value of blue. (0-255)
Here is the call graph for this function:

◆ setColour() [2/2]

void Text::setColour ( SDL_Colour  colour)

Sets the colour of the text.

Parameters
colourThe colour of the font.
Here is the call graph for this function:

◆ setFont()

void Text::setFont ( std::string  inFontLocation)

Sets the font of the text.

Parameters
inFontLocationThe location of the font file.
Here is the call graph for this function:

◆ setFontSize()

void Text::setFontSize ( int  inSize)

Sets the font size of the text.

Parameters
inSizeThe font size of the text.
Here is the call graph for this function:

◆ setText()

void Text::setText ( std::string  inText)

Sets the text.

Parameters
inTextThe text to display.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ dimensions

Vec2 Text::dimensions
private

The Texture dimensions.

◆ font

TTF_Font* Text::font
private

Font.

◆ fontColour

SDL_Colour Text::fontColour
private

Font colour.

◆ fontLocation

std::string Text::fontLocation
private

◆ fontSize

int Text::fontSize
private

Font size.

◆ surfaceData

Sprite* Text::surfaceData
private

The surface sprite.

◆ text

std::string Text::text
private

The text and font location.


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