Creates a Texture for use with a renderer. Creates a Texture from an image file, this can then be used with a renderer.
More...
#include <Texture.h>
|
| JAM_Texture (SDL_Renderer *renderer, int r, int g, int b) |
|
| JAM_Texture (std::string fileLocation, SDL_Renderer *renderer) |
|
| JAM_Texture (std::string fileLocation, SDL_Renderer *renderer, bool magentaAlpha) |
|
| ~JAM_Texture () |
|
SDL_Texture * | getTexture () |
|
int | getWidth () |
|
int | getHeight () |
|
void | pushToScreen (SDL_Renderer *renderer, int x, int y) |
|
void | pushToScreen (SDL_Renderer *renderer, int x, int y, int width, int height) |
|
void | pushSpriteToScreen (SDL_Renderer *renderer, int x, int y, int srcX, int srcY, int srcWidth, int srcHeight) |
|
void | pushSpriteToScreen (SDL_Renderer *renderer, int x, int y, int srcX, int srcY, int srcWidth, int srcHeight, int width, int height) |
|
Creates a Texture for use with a renderer. Creates a Texture from an image file, this can then be used with a renderer.
- Author
- Jamie Slowgrove Reference ~ This is a modified version of my PGG Assignment 1 Texture class.
JAM_Texture::JAM_Texture |
( |
SDL_Renderer * |
renderer, |
|
|
int |
r, |
|
|
int |
g, |
|
|
int |
b |
|
) |
| |
Constructs the Texture. Creates a Texture using an RGB value. This will create a 1x1 rectangle of that colour that can be scaled.
- Parameters
-
renderer | A pointer to the renderer. |
r | The red value. |
g | The green value. |
b | The blue value. |
JAM_Texture::JAM_Texture |
( |
std::string |
fileLocation, |
|
|
SDL_Renderer * |
renderer |
|
) |
| |
Constructs the Texture. Creates a Texture using an image location and a renderer. This is for use with SDL image.
- Parameters
-
fileLocation | The location of the image file. |
renderer | The renderer. |
JAM_Texture::JAM_Texture |
( |
std::string |
fileLocation, |
|
|
SDL_Renderer * |
renderer, |
|
|
bool |
magentaAlpha |
|
) |
| |
Constructs the Texture. Creates a Texture using an image location and a renderer. The magenta pixels of this image can represent alpha if needed.
- Parameters
-
fileLocation | The location of the image file. |
renderer | The renderer. |
magentaAlpha | If true any magenta pixels in the image will be converted to alpha. |
JAM_Texture::~JAM_Texture |
( |
| ) |
|
Destructs the Texture deleting the Texture from memory.
int JAM_Texture::getHeight |
( |
| ) |
|
Getter # Returns textureHeight.
- Returns
- The value of textureHeight.
SDL_Texture * JAM_Texture::getTexture |
( |
| ) |
|
Getter # Returns a pointer to the Texture.
- Returns
- A pointer to the Texture data.
int JAM_Texture::getWidth |
( |
| ) |
|
Getter # Returns textureWidth.
- Returns
- The value of textureWidth.
void JAM_Texture::pushSpriteToScreen |
( |
SDL_Renderer * |
renderer, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
srcX, |
|
|
int |
srcY, |
|
|
int |
srcWidth, |
|
|
int |
srcHeight |
|
) |
| |
Pushes the image to the Renderer, to the XY Coordinates. Only displays the source rectangle inputed.
- Parameters
-
renderer | The renderer. |
x | The x coordinate of the image. |
y | The y coordinate of the image. |
srcX | The x coordinate of the source image. |
srcY | The y coordinate of the source image. |
width | The width of the source image. |
height | The height of the source image. |
void JAM_Texture::pushSpriteToScreen |
( |
SDL_Renderer * |
renderer, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
srcX, |
|
|
int |
srcY, |
|
|
int |
srcWidth, |
|
|
int |
srcHeight, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Pushes the image to the Renderer, to the XY Coordinates. Only displays the source rectangle inputed. This is scaled to the width and height inputed.
- Parameters
-
renderer | The renderer. |
x | The x coordinate of the image. |
y | The y coordinate of the image. |
srcX | The x coordinate of the source image. |
srcY | The y coordinate of the source image. |
srcWidth | The width of the source image. |
srcHeight | The height of the source image. |
width | The width of the scaled image. |
height | The height of the scaled image. |
void JAM_Texture::pushToScreen |
( |
SDL_Renderer * |
renderer, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Pushes the image to the Renderer, to the XY Coordinates.
- Parameters
-
renderer | The renderer. |
x | The x coordinate of the image. |
y | The y coordinate of the image. |
void JAM_Texture::pushToScreen |
( |
SDL_Renderer * |
renderer, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Pushes the image to the Renderer, to the XY Coordinates. This is scaled to the width and height inputed.
- Parameters
-
renderer | The renderer. |
x | The x coordinate of the image. |
y | The y coordinate of the image. |
width | The width of the scaled image. |
height | The height of the scaled image. |
SDL_Texture* JAM_Texture::textureData |
|
private |
int JAM_Texture::textureHeight |
|
private |
The height of the Texture.
int JAM_Texture::textureWidth |
|
private |
The width of the Texture.
The documentation for this class was generated from the following files: