Creates a Text Texture for use with a renderer. Creates a Text Texture from an image file, this can then be used with a renderer.
More...
#include <Text.h>
|
| JAM_Text (std::string text, std::string fontLocation, SDL_Renderer *renderer) |
|
| JAM_Text (std::string text, std::string fontLocation, int fontSize, SDL_Renderer *renderer) |
|
| JAM_Text (std::string text, std::string fontLocation, SDL_Renderer *renderer, int r, int g, int b) |
|
| JAM_Text (std::string text, std::string fontLocation, int fontSize, SDL_Renderer *renderer, int r, int g, int b) |
|
| ~JAM_Text () |
|
void | pushToScreen (int x, int y) |
|
void | setColour (int r, int g, int b) |
|
void | setFontSize (int fontSize) |
|
void | setFont (std::string fontLocation) |
|
void | setText (std::string text) |
|
JAM_Vec2 | getDimensions () |
|
Creates a Text Texture for use with a renderer. Creates a Text Texture from an image file, this can then be used with a renderer.
- Author
- Jamie Slowgrove Reference ~ This is a modified version of my AI Assignment 1 Text class.
JAM_Text::JAM_Text |
( |
std::string |
text, |
|
|
std::string |
fontLocation, |
|
|
SDL_Renderer * |
renderer |
|
) |
| |
Constructs the Text Texture. Creates a Text Texture using an image location and a renderer. Font size and colour will be default (size 10 and black).
- Parameters
-
text | The text to display. |
fontLocation | The location of the font file. |
renderer | The renderer. |
JAM_Text::JAM_Text |
( |
std::string |
text, |
|
|
std::string |
fontLocation, |
|
|
int |
fontSize, |
|
|
SDL_Renderer * |
renderer |
|
) |
| |
Constructs the Text Texture. Creates a Text Texture using an image location and a renderer. Font colour will be default (black). Font size will be set to the input.
- Parameters
-
text | The text to display. |
fontLocation | The location of the font file. |
fontSize | The size of the font. |
renderer | The renderer. |
JAM_Text::JAM_Text |
( |
std::string |
text, |
|
|
std::string |
fontLocation, |
|
|
SDL_Renderer * |
renderer, |
|
|
int |
r, |
|
|
int |
g, |
|
|
int |
b |
|
) |
| |
Constructs the Text Texture. Creates a Text Texture using an image location and a renderer. Font size will be default (size 10). Colour will be set to the input.
- Parameters
-
text | The text to display. |
fontLocation | The location of the font file. |
renderer | The renderer. |
r | The value of red. (0-255) |
g | The value of green. (0-255) |
b | The value of blue. (0-255) |
JAM_Text::JAM_Text |
( |
std::string |
text, |
|
|
std::string |
fontLocation, |
|
|
int |
fontSize, |
|
|
SDL_Renderer * |
renderer, |
|
|
int |
r, |
|
|
int |
g, |
|
|
int |
b |
|
) |
| |
Constructs the Text Texture. Creates a Text Texture using an image location and a renderer.
- Parameters
-
text | The text to display. |
fontLocation | The location of the font file. |
fontSize | The size of the font. |
renderer | The renderer. |
r | The value of red. (0-255) |
g | The value of green. (0-255) |
b | The value of blue. (0-255) |
Destructs the Text Texture.
void JAM_Text::createTextTexture |
( |
| ) |
|
|
private |
Creates a Text Texture using the text data.
Getter # Gets the dimensions of the Text.
- Returns
- The dimensions of the Text.
void JAM_Text::pushToScreen |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Pushes the image to the Renderer, to the XY Coordinates. This is scaled to the width and height inputed.
- Parameters
-
x | The x coordinate of the image. |
y | The y coordinate of the image. |
void JAM_Text::setColour |
( |
int |
r, |
|
|
int |
g, |
|
|
int |
b |
|
) |
| |
Setter # Sets the colour of the text.
- Parameters
-
r | The value of red. (0-255) |
g | The value of green. (0-255) |
b | The value of blue. (0-255) |
void JAM_Text::setFont |
( |
std::string |
fontLocation | ) |
|
Setter # Sets the font of the text.
- Parameters
-
fontLocation | The location of the font file. |
void JAM_Text::setFontSize |
( |
int |
fontSize | ) |
|
Setter # Sets the font size of the text.
- Parameters
-
fontSize | The font size of the text. |
void JAM_Text::setText |
( |
std::string |
text | ) |
|
Setter # Sets the text.
- Parameters
-
SDL_Color JAM_Text::fontColour |
|
private |
std::string JAM_Text::fontLocation |
|
private |
SDL_Renderer* JAM_Text::renderer |
|
private |
std::string JAM_Text::text |
|
private |
SDL_Texture* JAM_Text::textureData |
|
private |
int JAM_Text::textureHeight |
|
private |
int JAM_Text::textureWidth |
|
private |
The documentation for this class was generated from the following files: