#include <SlTexture.h>
|
| | SlTexture (const std::string &name) |
| |
| | ~SlTexture () |
| |
| | SlTexture (const SlTexture &)=delete |
| |
| SlTexture & | operator= (const SlTexture &)=delete |
| |
| SlTexture * | createFromRectangle (SDL_Renderer *renderer, int width, int height, uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) |
| |
| SlTexture * | createFromSpriteOnTexture (SDL_Renderer *renderer, SlTexture *backgroundTexture, const std::shared_ptr< SlSprite > foregroundSprite) |
| |
| SlTexture * | createFromText (SDL_Renderer *renderer, const std::shared_ptr< SlFont > font, const std::string &message, int width) |
| |
| SlTexture * | createFromTile (SDL_Renderer *renderer, const std::shared_ptr< SlSprite > tile, int width, int height) |
| |
| void | dimensions (int &width, int &height) |
| |
| SlTexture * | loadFromFile (SDL_Renderer *renderer, const std::string &fileName) |
| |
| std::string | name () const |
| |
| SDL_Texture * | texture () |
| |
| SlTexture::SlTexture |
( |
const std::string & |
name | ) |
|
Constructor with texture name.
All textures have a name. Remember to create the actual texture!
| SlTexture::~SlTexture |
( |
| ) |
|
Delete copy constructor. There's no reason to copy the texture, if the goal is to render different parts of it or with different options create a SlSprite.
| SlTexture * SlTexture::createFromRectangle |
( |
SDL_Renderer * |
renderer, |
|
|
int |
width, |
|
|
int |
height, |
|
|
uint8_t |
red, |
|
|
uint8_t |
green, |
|
|
uint8_t |
blue, |
|
|
uint8_t |
alpha |
|
) |
| |
createFromRectangle uses SDL_FillRect to create a texture based on the given geometry and the color defined in SlTextureInfo.
- Exceptions
-
| std::runtime_error | if texture can't be created or rectangle can't be rendered. |
| SlTexture * SlTexture::createFromSpriteOnTexture |
( |
SDL_Renderer * |
renderer, |
|
|
SlTexture * |
backgroundTexture, |
|
|
const std::shared_ptr< SlSprite > |
foregroundSprite |
|
) |
| |
Create a new texture by rendering a sprite on this texture. Calls SlSprite::render() for the sprite.
- Exceptions
-
| std::runtime_error | if texture can't be created or rendered. |
| SlTexture * SlTexture::createFromText |
( |
SDL_Renderer * |
renderer, |
|
|
const std::shared_ptr< SlFont > |
font, |
|
|
const std::string & |
message, |
|
|
int |
width |
|
) |
| |
Create a new texture from the message using the specified SlFont.
- Exceptions
-
| std::runtime_error | if surface or texture can't be created. |
| SlTexture * SlTexture::createFromTile |
( |
SDL_Renderer * |
renderer, |
|
|
const std::shared_ptr< SlSprite > |
tile, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Creates a new texture with dimensions w x h and fills it with tiles of SlSprite tile.
The SlRenderSettings::destinationRect at position 0 in the sprite's lSprite::destinations_ is used to determine the width of the tile.
If the sprite's SlSprite::destinations_ is empty, addDefaultDestination() is called which sets the destinationRect to equal the sourceRect.
- Exceptions
-
| std::runtime_error | if the texture can't be created or the step size for placing the tiles it <= 0. |
| void SlTexture::dimensions |
( |
int & |
width, |
|
|
int & |
height |
|
) |
| |
Returns the dimensions of the SDL_Texture.
| SlTexture * SlTexture::loadFromFile |
( |
SDL_Renderer * |
renderer, |
|
|
const std::string & |
fileName |
|
) |
| |
uses IMG_LoadTexture to get texture from png image file
- Exceptions
-
| std::runtime_error | if object already has a texture or texture can't be loaded. |
| std::string SlTexture::name |
( |
| ) |
const |
|
inline |
Returns the name of the texture. Changing the name after creation is not allowed.
Deleted, same reason as copy constructor.
| SDL_Texture* SlTexture::texture |
( |
| ) |
|
|
inline |
Returns the SDL_texture. Changing the texture is not allowed.
| bool SlTexture::alphaModIsSet = false |
alphaModIsSet stores whether SDL_SetTextureAlphaMod has been applied. If true but the RenderOptions for the next render call don't request the mod anymore, the texture is reset to default.
| bool SlTexture::colorModIsSet = false |
colorModIsSet stores whether SDL_SetTextureColorMod has been applied. If true but the RenderOptions for the next render call don't request the mod anymore, the texture is reset to default.
| std::string SlTexture::name_ = "unnamedTexture" |
|
protected |
The object's name. Cannot be changed.
| SDL_Texture* SlTexture::texture_ |
|
protected |
The documentation for this class was generated from the following files: