|
LPCGame
A Simple 2d Game Engine
|
Handles drawing some text. More...
#include <text.h>
Public Member Functions | |
| Text (std::string message, std::string font, Color color, int fontSize=30) | |
| void | Set (std::string message, std::string font, Color color, int fontSize=30) |
| void | SetMessage (std::string message) |
| void | SetFont (std::string font) |
| void | SetFontSize (int fontSize) |
| void | SetColor (Color color) |
| std::string | GetMessage () |
| std::string | GetFont () |
| int | GetFontSize () |
| Color | GetColor () |
| SDL_Texture * | Texture () |
| Recti | Size () const |
| void | Size (int *w, int *h=NULL) const |
| int | W () const |
| Get the width of the text. | |
| int | H () const |
| Get the height. | |
| Json::Value | Save () const |
| void | Load (Json::Value val) |
Handles drawing some text.
A simple class for drawing a string to a texture with some color and a specified TTF_Font and font size
| Text::Text | ( | std::string | message, |
| std::string | font, | ||
| Color | color, | ||
| int | fontSize = 30 |
||
| ) |
Setup the text object with a message, font and font size
| message | The message to be displayed |
| font | The font file to use |
| fontSize | The font size to use, default is 30 |
| color | The color of font to use, default is black |
| Color Text::GetColor | ( | ) |
Get the current text color
| std::string Text::GetFont | ( | ) |
Get the font file currently being used
| int Text::GetFontSize | ( | ) |
Get the font size currently being used
| std::string Text::GetMessage | ( | ) |
Get the message text being displayed
| void Text::Load | ( | Json::Value | val | ) |
Load the text data from a Json::Value
| val | The Json::Value to load from |
| Json::Value Text::Save | ( | ) | const |
Save the text data to a Json::Value
| void Text::Set | ( | std::string | message, |
| std::string | font, | ||
| Color | color, | ||
| int | fontSize = 30 |
||
| ) |
Set a message, font and font size
| message | The message to be displayed |
| font | The font file to use |
| fontSize | The font size to use, default is 30 |
| color | The color of font to use, default is black |
| void Text::SetColor | ( | Color | color | ) |
Set the font color to use, checks to make sure color is different before redrawing
| color | The color to use |
| void Text::SetFont | ( | std::string | font | ) |
Set a font for the text to use, checks to make sure font is different before loading the new font and rendering message
| font | The font file to use |
| void Text::SetFontSize | ( | int | fontSize | ) |
Set the font size to use, checks to make sure size is different before reloading the font with the new size
| fontSize | The font size to use |
| void Text::SetMessage | ( | std::string | message | ) |
Set a message for the text, checks to make sure message is different before rendering the new message
| message | The message to display |
| Recti Text::Size | ( | ) | const |
Get a rect containing the message texture's width and height
| void Text::Size | ( | int * | w, |
| int * | h = NULL |
||
| ) | const |
Store the width and height values of the texture in the values passed
| w | The value to store the width in |
| h | The value to store the height in |
| SDL_Texture * Text::Texture | ( | ) |
Get the texture pointer of the font, used for the window's draw functions