|
| | SlTextureManager (SlManager *manager) |
| |
| | SlTextureManager (const SlTextureManager &)=delete |
| |
| SlTextureManager & | operator= (const SlTextureManager &)=delete |
| |
| SlTexture * | createTextureFromFile (const std::string &name, const std::string &filename) |
| |
| SlTexture * | createTextureFromRectangle (const std::string &name, int width, int height, uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha=0xFF) |
| |
| SlTexture * | createTextureFromSpriteOnTexture (const std::string &name, const std::string &backgroundTexture, const std::string &foregroundSprite) |
| |
| SlTexture * | createTextureFromText (const std::string &name, const std::string &fontname, const std::string &message, int width) |
| |
| SlTexture * | createTextureFromTile (const std::string &name, const std::string &sprite, int width, int height) |
| |
| void | deleteTexture (const std::string &name) |
| |
| std::shared_ptr< SlFont > | findFont (const std::string &name) |
| |
| SlTexture * | findTexture (const std::string &name) |
| |
| std::shared_ptr< SlFont > | parseFont (std::ifstream &input) |
| |
| SlTexture * | parseTexture (std::ifstream &input) |
| |
| SlTextureManager::SlTextureManager |
( |
SlManager * |
manager | ) |
|
Initializes SDL, creates window with name and width, height
Delete copy constructor. The manager owns the window, don't want copies of that.
| SlTextureManager::SlTextureManager |
( |
void |
| ) |
|
|
protected |
| void SlTextureManager::addTexture |
( |
SlTexture * |
toAdd | ) |
|
|
protected |
| void SlTextureManager::clear |
( |
| ) |
|
|
protected |
Deletes all textures and sprites, empties render queue.
| SlTexture * SlTextureManager::createTextureFromFile |
( |
const std::string & |
name, |
|
|
const std::string & |
filename |
|
) |
| |
Load texture from image filename
| SlTexture * SlTextureManager::createTextureFromRectangle |
( |
const std::string & |
name, |
|
|
int |
width, |
|
|
int |
height, |
|
|
uint8_t |
red, |
|
|
uint8_t |
green, |
|
|
uint8_t |
blue, |
|
|
uint8_t |
alpha = 0xFF |
|
) |
| |
Creates SlTexture using a rectangle of dimension width x height filled with the specified colour.
Creates SlSprite of same name that holds the whole texture.
| SlTexture * SlTextureManager::createTextureFromSpriteOnTexture |
( |
const std::string & |
name, |
|
|
const std::string & |
backgroundTexture, |
|
|
const std::string & |
foregroundSprite |
|
) |
| |
Create a new texture by rendering a sprite on this texture.
Creates SlSprite of same name that holds the whole texture.
| SlTexture * SlTextureManager::createTextureFromText |
( |
const std::string & |
name, |
|
|
const std::string & |
fontname, |
|
|
const std::string & |
message, |
|
|
int |
width |
|
) |
| |
Create a new texture from the message using the specified font. The text will be wrapped to fit the width.
| SlTexture * SlTextureManager::createTextureFromTile |
( |
const std::string & |
name, |
|
|
const std::string & |
sprite, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
| void SlTextureManager::deleteTexture |
( |
const std::string & |
name | ) |
|
Delete the specified texture and remove from textures_ .
Also deletes the SlSprite of same name that was created automatically with the texture.
| std::shared_ptr< SlFont > SlTextureManager::findFont |
( |
const std::string & |
name | ) |
|
Returns pointer to the named font.
- Return values
-
| SlTexture * SlTextureManager::findTexture |
( |
const std::string & |
name | ) |
|
Returns pointer to the named texture.
- Return values
-
Deleted, same reason as copy constructor.
| std::shared_ptr< SlFont > SlTextureManager::parseFont |
( |
std::ifstream & |
input | ) |
|
Read font file, size, colour from file
| SlTexture * SlTextureManager::parseTexture |
( |
std::ifstream & |
input | ) |
|
Read texture configurations from file
<- message[0] is space between token and beginning of text.
| std::vector<std::shared_ptr<SlFont> > SlTextureManager::fonts_ |
|
private |
Font used for rendering. This is kept open until program exits to reduce overhead from opening and closing font file.
Pointer to the running SlManager that created this TextureManager.
| std::vector<SlTexture*> SlTextureManager::textures_ |
|
private |
Helper object to translate file input into values.
The documentation for this class was generated from the following files: