Wrapper around the SDL_Texture to make things easier.
More...
#include <image.h>
Inherited by AnimatedImage.
|
std::shared_ptr< SDL_Texture > | mTexture |
|
std::string | mFile |
|
Recti * | mClips |
|
int | mNumClips |
|
int | mActiveClip |
|
Wrapper around the SDL_Texture to make things easier.
A wrapper around the SDL_Texture class to make using images and setting clips or loading/saving them easier
Image::Image |
( |
const std::string & |
file | ) |
|
Setup the Image class, if a filename is passed load the image
- Parameters
-
- See Also
- Window::LoadImage for the loading function
Free the clips vector, b/c the SDL_Surface is a shared ptr it's cleaned up automatically
Recti Image::Clip |
( |
int |
clipNum | ) |
const |
Get the rect for a desired clipnum
- Parameters
-
clipNum | The clip number to get the box of |
- Returns
- The Recti corresponding to the clip box
Recti Image::Clip |
( |
| ) |
const |
Get the clip of mActiveClip
- Returns
- The Recti of the active clip
int Image::ClipCount |
( |
| ) |
const |
Returns the number of clips in the image
- Returns
- int The number of clips.
void Image::GenClips |
( |
int |
cW, |
|
|
int |
cH |
|
) |
| |
Generate clips based on the desired width and height of each clip and the size of the image, note that this will only work for uniform clip sizes
- Parameters
-
cW | The desired width of each clip |
cH | The desired height of each clip |
void Image::Load |
( |
const std::string & |
file | ) |
|
|
virtual |
Load an Image and it's config data from a filename
- Parameters
-
file | The file to load from, the config file will be file.json |
- See Also
- Window::LoadTexture for the texture loading function
void Image::Save |
( |
const std::string & |
file | ) |
const |
|
virtual |
void Image::SetActiveClip |
( |
int |
clip | ) |
|
Set the active clip
- Parameters
-
clip | The clip number to set active |
void Image::SetClips |
( |
const std::vector< Recti > & |
clips | ) |
|
Set the image's clips to the vector passed
- Parameters
-
clips | The clips to use for the image |
TODO: Will Lua be able to pass a vector to C++? Will a Lua array convert ok? curious what will happen here
void Image::Size |
( |
int * |
w, |
|
|
int * |
h = NULL |
|
) |
| const |
Store the width and height values of the texture in the values passed
- Parameters
-
w | The value to store the width in |
h | The value to store the height in |
SDL_Texture * Image::Texture |
( |
| ) |
|
Get the raw SDL_Texture pointer, this is only used inside the Window's draw functions as SDL expects a regular SDL_Texture pointer to draw
- See Also
- Window
- Returns
- SDL_Texture pointer to the image's texture
The documentation for this class was generated from the following files:
- C:/Users/Will/Documents/Programs/LPCGame/src/core/image.h
- C:/Users/Will/Documents/Programs/LPCGame/src/core/image.cpp