Caseus Tower
 All Classes Namespaces Files Functions Variables
Texture Class Reference

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>

Public Member Functions

 Texture (SDL_Renderer *, int, int, int)
 
 Texture (std::string, SDL_Renderer *)
 
 Texture (std::string, SDL_Renderer *, bool)
 
 ~Texture ()
 
SDL_Texture * getTexture ()
 
int getWidth ()
 
int getHeight ()
 
void pushToScreen (SDL_Renderer *, int, int)
 
void pushToScreen (SDL_Renderer *, int, int, int, int)
 
void pushSpriteToScreen (SDL_Renderer *, int, int, int, int, int, int)
 
void pushSpriteToScreen (SDL_Renderer *, int, int, int, int, int, int, int, int)
 

Private Attributes

SDL_Texture * textureData
 
int textureWidth
 
int textureHeight
 

Detailed Description

Creates a Texture for use with a renderer Creates a Texture from an image file, this can then be used with a renderer.

Definition at line 12 of file texture.h.

Constructor & Destructor Documentation

Texture::Texture ( SDL_Renderer *  ,
int  ,
int  ,
int   
)

Constructs a Texture Creates a Texture using an rbg value. This will create a 1x1 rectangle of that colour that can be scaled.

Parameters
std::stringThe location of the image file.
intr
intg
intb
Texture::Texture ( std::string  ,
SDL_Renderer *   
)

Constructs a Texture Creates a Texture using an image location and a renderer. The magenta pixels of this image can represent alpha if needed. This is for use with SDL image.

Parameters
std::stringThe location of the image file.
SDL_Renderer*The renderer.
Texture::Texture ( std::string  ,
SDL_Renderer *  ,
bool   
)

Constructs a Texture Creates a Texture using an image location and a renderer. The magenta pixels of this image can represent alpha if needed.

Parameters
std::stringThe location of the image file.
SDL_Renderer*The renderer.
boolIf true any magenta pixels in the image will be converted to alpha
Texture::~Texture ( )

De-constructs a Texture De-constructs the Texture deleting the Texture from memory.

Member Function Documentation

int Texture::getHeight ( )

Getter # Returns textureHeight Returns the value of textureHeight.

SDL_Texture* Texture::getTexture ( )

Getter # Returns a pointer to the Texture Returns a pointer to the Texture data.

int Texture::getWidth ( )

Getter # Returns textureWidth Returns the value of textureWidth.

void Texture::pushSpriteToScreen ( SDL_Renderer *  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int   
)

Pushes the image to the Renderer, to the XY Coordinates. Only displays the source rectangle inputed.

Parameters
SDL_Renderer*The renderer.
intx coordinate of the image.
inty coordinate of the image.
intx coordinate of the source image.
inty coordinate of the source image.
intwidth of the source image.
intheight of the source image.
void Texture::pushSpriteToScreen ( SDL_Renderer *  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int   
)

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
SDL_Renderer*The renderer.
intx coordinate of the image.
inty coordinate of the image.
intx coordinate of the source image.
inty coordinate of the source image.
intwidth of the source image.
intheight of the source image.
intwidth of the scaled image.
intheight of the scaled image.
void Texture::pushToScreen ( SDL_Renderer *  ,
int  ,
int   
)

Pushes the image to the Renderer, to the XY Coordinates.

Parameters
SDL_Renderer*The renderer.
intx coordinate of the image.
inty coordinate of the image.
void Texture::pushToScreen ( SDL_Renderer *  ,
int  ,
int  ,
int  ,
int   
)

Pushes the image to the Renderer, to the XY Coordinates. This is scaled to the width and height inputed.

Parameters
SDL_Renderer*The renderer.
intx coordinate of the image.
inty coordinate of the image.
intwidth of the scaled image.
intheight of the scaled image.

Member Data Documentation

SDL_Texture* Texture::textureData
private

The Texture data

Definition at line 16 of file texture.h.

int Texture::textureHeight
private

Definition at line 19 of file texture.h.

int Texture::textureWidth
private

The dimensions of the Texture

Definition at line 18 of file texture.h.


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