Wraith
0.1.5
Basic 3D game engine in C++
|
A SpriteString entity is used for displaying a 2D text messages on the screen. It can be used anywhere within a user defined GameObject. More...
Functions | |
SpriteString::SpriteString (SpriteFont *pSpriteFont, const std::string &message, int positionX, int positionY) | |
Constructor. More... | |
void | SpriteString::set (SpriteFont *pSpriteFont, const std::string &message, int positionX, int positionY) |
Sets sprite string data. More... | |
void | SpriteString::setPosition (int positionX, int positionY) |
Sets a position. More... | |
int | SpriteString::getPositionX () const |
Gets position x coordinate. More... | |
int | SpriteString::getPositionY () const |
Gets position y coordinate. More... | |
int | SpriteString::getWidth () const |
Gets the width. More... | |
int | SpriteString::getHeight () const |
Gets the height. More... | |
void | SpriteString::render () |
Renders the sprite string message onto the string. More... | |
A SpriteString entity is used for displaying a 2D text messages on the screen. It can be used anywhere within a user defined GameObject.
A SpriteString takes in a SpriteFont pointer, a message, and the X and Y position of the screen. X = 0 and Y = 0 is the lower left corner of the screen. This is either done with the SpriteString constructor or the SpriteString::set() function. The position of the SpriteString can changed anytime.
IMPORTANT: To render a SpriteString entity, it you must call SpriteString::render() within the GameObject::draw2D() callback in order to display the sprite properly.
Here is an example of how a sprite can be used. IMPORTANT: You must include SpriteString.h and SpriteFontManager.h
int SpriteString::getHeight | ( | ) | const |
Gets the height.
int SpriteString::getPositionX | ( | ) | const |
Gets position x coordinate.
int SpriteString::getPositionY | ( | ) | const |
Gets position y coordinate.
int SpriteString::getWidth | ( | ) | const |
Gets the width.
void SpriteString::render | ( | ) |
Renders the sprite string message onto the string.
This must be called within GameObject::draw2D() callback.
void SpriteString::set | ( | SpriteFont * | pSpriteFont, |
const std::string & | message, | ||
int | positionX, | ||
int | positionY | ||
) |
Sets sprite string data.
pSpriteFont | sprite font pointer. |
message | The message. |
positionX | The position x coordinate. |
positionY | The position y coordinate. |
void SpriteString::setPosition | ( | int | positionX, |
int | positionY | ||
) |
Sets a position.
positionX | The position x coordinate. |
positionY | The position y coordinate. |
SpriteString::SpriteString | ( | SpriteFont * | pSpriteFont, |
const std::string & | message, | ||
int | positionX, | ||
int | positionY | ||
) |
Constructor.
pSpriteFont | sprite font pointer. |
message | The message. |
positionX | The position x coordinate. |
positionY | The position y coordinate. |