Sky Zone Omega - PC Version
 All Classes Namespaces Files Functions Variables Macros
Public Member Functions | Private Attributes | List of all members
C_Texture Class Reference

Creates a Texture for use with a renderer. More...

#include <C_Texture.h>

Collaboration diagram for C_Texture:
Collaboration graph

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...
 

Detailed Description

Creates a Texture for use with a renderer.

Author
Jamie Slowgrove

Constructor & Destructor Documentation

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.

Parameters
rendererA pointer to the renderer.
rThe red value.
gThe green value.
bThe 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.

Parameters
rendererA pointer to the renderer.
colourThe 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.

Parameters
fileLocationThe location of the image file.
rendererA pointer to the renderer.

Here is the call graph for this function:

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.

Parameters
fileLocationThe location of the image file.
rendererA pointer to the renderer.
magentaAlphaIf true any magenta pixels in the image will be converted to alpha.

Here is the call graph for this function:

C_Texture::~C_Texture ( )

Destructs Texture.

Member Function Documentation

C_Vec2 C_Texture::getDimensions ( )

Gets the Texture dimensions.

Returns
The Texture dimensions.
SDL_Texture * C_Texture::getTexture ( )

Gets a pointer to the Texture.

Returns
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.

Parameters
rendererA pointer to the renderer.
posThe position of the image.
spritePosThe position of the sprite in the spritesheet.
spriteDimensionsThe dimensions of the sprite.

Here is the caller graph for this function:

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.

Parameters
rendererA pointer to the renderer.
posThe position of the image.
scaleThe dimensions of the image.
spritePosThe position of the sprite in the spritesheet.
spriteDimensionsThe dimensions of the sprite.
void C_Texture::pushToScreen ( SDL_Renderer *  renderer,
C_Vec2  pos 
)

Pushes the image to the Renderer at the XY Coordinates.

Parameters
rendererA pointer to the renderer.
posThe position of the image.

Here is the caller graph for this function:

void C_Texture::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.

Parameters
rendererA pointer to the renderer.
posThe position of the image.
scaleThe dimensions of the image.
void C_Texture::setColourTint ( int  r,
int  g,
int  b 
)

Tints the texture with the inputed colour.

Parameters
rThe red value.
gThe green value.
bThe blue value.

Here is the caller graph for this function:

void C_Texture::setColourTint ( SDL_Colour  colour)

Tints the texture with the inputed colour.

Parameters
colourThe colour.

Member Data Documentation

C_Vec2 C_Texture::dimensions
private

The Texture dimensions.

SDL_Texture* C_Texture::textureData
private

The Texture data.


The documentation for this class was generated from the following files: