Jamie Slowgrove - PGG Assignment 1 - SDL
 All Classes Functions
Public Member Functions | List of all members
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>

Collaboration diagram for Texture:
Collaboration graph

Public Member Functions

 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)
 

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.

Constructor & Destructor Documentation

Texture::Texture ( std::string  fileName,
SDL_Renderer *  renderer,
bool  magentaAlpha 
)

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

Here is the caller graph for this function:

void 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
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 *  renderer,
int  x,
int  y 
)

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.

Here is the caller graph for this function:

void 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
SDL_Renderer*The renderer.
intx coordinate of the image.
inty coordinate of the image.
intwidth of the scaled image.
intheight of the scaled image.

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