Creates a Texture for use with a renderer. More...
#include <C_Texture.h>
Public Member Functions | |
C_Texture (SDL_Renderer *renderer, int r, int g, int b) | |
Constructs the Texture using an RGB value. This will create a 1x1 rectangle of that colour that can be scaled. More... | |
C_Texture (SDL_Renderer *renderer, SDL_Colour colour) | |
Constructs the Texture using an RGB value. This will create a 1x1 rectangle of that colour that can be scaled. More... | |
C_Texture (std::string fileLocation, SDL_Renderer *renderer) | |
Constructs the Texture using an image location and a renderer. This is for use with SDL image. More... | |
C_Texture (std::string fileLocation, SDL_Renderer *renderer, bool magentaAlpha) | |
Constructs the Texture using an image location and a renderer. The magenta pixels of this image can represent alpha if needed. More... | |
~C_Texture () | |
Destructs Texture. More... | |
SDL_Texture * | getTexture () |
Gets a pointer to the Texture. More... | |
C_Vec2 | getDimensions () |
Gets the Texture dimensions. More... | |
void | pushToScreen (SDL_Renderer *renderer, C_Vec2 pos) |
Pushes the image to the Renderer at the XY Coordinates. More... | |
void | pushToScreen (SDL_Renderer *renderer, C_Vec2 pos, C_Vec2 scale) |
Pushes the image to the Renderer at the XY Coordinates. This is scaled to the dimensions inputed. More... | |
void | pushSpriteToScreen (SDL_Renderer *renderer, C_Vec2 pos, C_Vec2 spritePos, C_Vec2 spriteDimensions) |
Pushes the image to the Renderer at the XY Coordinates. Only displays the source rectangle inputed. More... | |
void | pushSpriteToScreen (SDL_Renderer *renderer, C_Vec2 pos, C_Vec2 scale, C_Vec2 spritePos, C_Vec2 spriteDimensions) |
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. More... | |
void | setColourTint (int r, int g, int b) |
Tints the texture with the inputed colour. More... | |
void | setColourTint (SDL_Colour colour) |
Tints the texture with the inputed colour. More... | |
Private Attributes | |
SDL_Texture * | textureData |
The Texture data. More... | |
C_Vec2 | dimensions |
The Texture dimensions. More... | |
Creates a Texture for use with a renderer.
C_Texture::C_Texture | ( | SDL_Renderer * | renderer, |
int | r, | ||
int | g, | ||
int | b | ||
) |
Constructs the Texture using an RGB value. This will create a 1x1 rectangle of that colour that can be scaled.
renderer | A pointer to the renderer. |
r | The red value. |
g | The green value. |
b | The blue value. |
C_Texture::C_Texture | ( | SDL_Renderer * | renderer, |
SDL_Colour | colour | ||
) |
Constructs the Texture using an RGB value. This will create a 1x1 rectangle of that colour that can be scaled.
renderer | A pointer to the renderer. |
colour | The colour value. |
C_Texture::C_Texture | ( | std::string | fileLocation, |
SDL_Renderer * | renderer | ||
) |
Constructs the Texture using an image location and a renderer. This is for use with SDL image.
fileLocation | The location of the image file. |
renderer | A pointer to the renderer. |
C_Texture::C_Texture | ( | std::string | fileLocation, |
SDL_Renderer * | renderer, | ||
bool | magentaAlpha | ||
) |
Constructs the Texture using an image location and a renderer. The magenta pixels of this image can represent alpha if needed.
fileLocation | The location of the image file. |
renderer | A pointer to the renderer. |
magentaAlpha | If true any magenta pixels in the image will be converted to alpha. |
C_Texture::~C_Texture | ( | ) |
Destructs Texture.
C_Vec2 C_Texture::getDimensions | ( | ) |
Gets the Texture dimensions.
SDL_Texture * C_Texture::getTexture | ( | ) |
Gets a pointer to the Texture.
void C_Texture::pushSpriteToScreen | ( | SDL_Renderer * | renderer, |
C_Vec2 | pos, | ||
C_Vec2 | spritePos, | ||
C_Vec2 | spriteDimensions | ||
) |
Pushes the image to the Renderer at the XY Coordinates. Only displays the source rectangle inputed.
renderer | A pointer to the renderer. |
pos | The position of the image. |
spritePos | The position of the sprite in the spritesheet. |
spriteDimensions | The dimensions of the sprite. |
void C_Texture::pushSpriteToScreen | ( | SDL_Renderer * | renderer, |
C_Vec2 | pos, | ||
C_Vec2 | scale, | ||
C_Vec2 | spritePos, | ||
C_Vec2 | spriteDimensions | ||
) |
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.
renderer | A pointer to the renderer. |
pos | The position of the image. |
scale | The dimensions of the image. |
spritePos | The position of the sprite in the spritesheet. |
spriteDimensions | The dimensions of the sprite. |
void C_Texture::pushToScreen | ( | SDL_Renderer * | renderer, |
C_Vec2 | pos | ||
) |
Pushes the image to the Renderer at the XY Coordinates.
renderer | A pointer to the renderer. |
pos | The position of the image. |
Pushes the image to the Renderer at the XY Coordinates. This is scaled to the dimensions inputed.
renderer | A pointer to the renderer. |
pos | The position of the image. |
scale | The dimensions of the image. |
void C_Texture::setColourTint | ( | int | r, |
int | g, | ||
int | b | ||
) |
Tints the texture with the inputed colour.
r | The red value. |
g | The green value. |
b | The blue value. |
void C_Texture::setColourTint | ( | SDL_Colour | colour | ) |
Tints the texture with the inputed colour.
colour | The colour. |
|
private |
The Texture dimensions.
|
private |
The Texture data.