Jamie Slowgrove - AI Assignment 1
Line of Sight & A* path-finding
 All Classes Namespaces Files Functions Variables
Public Member Functions | Private Attributes | 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. DISCLAIMER - This code is from my PGG SDL Assignment. More...

#include <texture.h>

Collaboration diagram for Texture:
Collaboration graph

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. DISCLAIMER - This code is from my PGG SDL Assignment.

Constructor & Destructor Documentation

Texture::Texture ( SDL_Renderer *  renderer,
int  r,
int  g,
int  b 
)

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  fileName,
SDL_Renderer *  renderer 
)

Constructs a Texture Creates a Texture using an image location and a renderer. This is for use with SDL image.

Parameters
std::stringThe location of the image file.
SDL_Renderer*The renderer.
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 ( )

Destructs a Texture Destructs 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.

Member Data Documentation

SDL_Texture* Texture::textureData
private

The Texture data

int Texture::textureHeight
private
int Texture::textureWidth
private

The dimensions of the Texture


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