Creates a Sprite for use with 2D.
More...
#include <Sprite.h>
Creates a Sprite for use with 2D.
◆ Sprite() [1/5]
Sprite::Sprite |
( |
int |
r, |
|
|
int |
g, |
|
|
int |
b |
|
) |
| |
Constructs the Sprite using an RGB value. This will create a 1x1 rectangle of that colour that can be scaled.
- Parameters
-
r | The red value. |
g | The green value. |
b | The blue value. |
◆ Sprite() [2/5]
Sprite::Sprite |
( |
SDL_Surface * |
inSurfaceData | ) |
|
Constructs the Sprite using a surface.
◆ Sprite() [3/5]
Sprite::Sprite |
( |
SDL_Colour |
colour | ) |
|
Constructs the Sprite using an RGB value. This will create a 1x1 rectangle of that colour that can be scaled.
- Parameters
-
◆ Sprite() [4/5]
Sprite::Sprite |
( |
std::string |
fileLocation | ) |
|
Constructs the Sprite using an image location and a renderer. This is for use with SDL image.
- Parameters
-
fileLocation | The location of the image file. |
◆ Sprite() [5/5]
Sprite::Sprite |
( |
std::string |
fileLocation, |
|
|
bool |
magentaAlpha |
|
) |
| |
Constructs the Sprite using an image location and a renderer. The magenta pixels of this image can represent alpha if needed.
- Parameters
-
fileLocation | The location of the image file. |
magentaAlpha | If true any magenta pixels in the image will be converted to alpha. |
◆ ~Sprite()
◆ draw()
void Sprite::draw |
( |
Vec2 |
pos | ) |
|
|
private |
A function to draw to a position on the screen.
- Parameters
-
pos | The position of the image. |
◆ getDimensions()
Vec2 Sprite::getDimensions |
( |
| ) |
|
◆ getSurface()
SDL_Surface * Sprite::getSurface |
( |
| ) |
|
Gets a pointer to the Sprite surface.
- Returns
- A pointer to the Sprite surface.
◆ initaliseVBO()
void Sprite::initaliseVBO |
( |
Vec2 |
pos, |
|
|
Vec2 |
scale |
|
) |
| |
|
private |
A function to initalise a VBO for the sprite.
- Parameters
-
pos | The position of the image. |
scale | The dimensions of the image. |
◆ initialiseTexture()
void Sprite::initialiseTexture |
( |
| ) |
|
|
private |
A function to initalise a texture.
◆ pushToScreen()
void Sprite::pushToScreen |
( |
Vec2 |
pos | ) |
|
Pushes the image to the Renderer at the XY Coordinates.
- Parameters
-
pos | The position of the image. |
◆ scaleSprite()
void Sprite::scaleSprite |
( |
Vec2 |
scale | ) |
|
Scale the image to the dimensions inputed.
- Parameters
-
pos | The position of the image. |
scale | The dimensions of the image. |
◆ dimensions
◆ obj
The VBO for the rectangle.
◆ shaderID
std::string Sprite::shaderID |
|
private |
◆ surfaceData
SDL_Surface* Sprite::surfaceData |
|
private |
◆ textureID
The documentation for this class was generated from the following files: