|
| | SlSpriteManager (SlManager *mngr) |
| |
| | SlSpriteManager (const SlSpriteManager &)=delete |
| |
| SlSpriteManager & | operator= (const SlSpriteManager &)=delete |
| |
| void | centerSpriteInSprite (const std::string &toCenter, const std::string &target, unsigned int destinationThis=0, unsigned int destinationOther=0) |
| |
| bool | checkSpriteName (const std::string &name) |
| |
| std::shared_ptr< SlSprite > | createSprite (SlTexture *texture, int x=0, int y=0, int width=0, int height=0) |
| |
| std::shared_ptr< SlSprite > | createSprite (const std::string &name, const std::string &textureName, int x=0, int y=0, int width=0, int height=0) |
| |
| void | deleteSprite (const std::string &name) |
| |
| void | deleteSprites (const std::string &textureName) |
| |
| std::shared_ptr< SlSprite > | findSprite (const std::string &name) |
| |
| void | initialize (SlValueParser *valPars) |
| |
| std::map< std::string, SlManipulation * > | manipulations () |
| |
| void | parseSprite (std::ifstream &input) |
| |
| void | parseSpriteManipulation (std::ifstream &input) |
| |
| void | setSpriteColor (const std::string &name, uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha=0xFF, unsigned int destination=0) |
| |
| void | setSpriteDestinationOrigin (const std::string &name, int x, int y, unsigned int destination=0) |
| |
| void | setSpriteRenderOptions (const std::string &name, uint32_t renderOptions, unsigned int destination=0) |
| |
|
| | SlSpriteManager () |
| |
| void | clear () |
| |
| void | manipulateSprite (const std::string &name, unsigned int destination, const std::string &whatToDo, const std::vector< std::string > ¶meters) |
| |
| SlSpriteManager::SlSpriteManager |
( |
SlManager * |
mngr | ) |
|
Initializes SDL, creates window with name and width, height
Delete copy constructor. The manager owns the window, don't want copies of that.
| SlSpriteManager::SlSpriteManager |
( |
| ) |
|
|
protected |
| void SlSpriteManager::centerSpriteInSprite |
( |
const std::string & |
toCenter, |
|
|
const std::string & |
target, |
|
|
unsigned int |
destinationThis = 0, |
|
|
unsigned int |
destinationOther = 0 |
|
) |
| |
Centers the destination of the sprite in the destinationRect of the target sprite.
Note that if the destination dimensions are changed afterwards, the sprite will no longer be centered.
| bool SlSpriteManager::checkSpriteName |
( |
const std::string & |
name | ) |
|
| void SlSpriteManager::clear |
( |
| ) |
|
|
protected |
| std::shared_ptr< SlSprite > SlSpriteManager::createSprite |
( |
SlTexture * |
texture, |
|
|
int |
x = 0, |
|
|
int |
y = 0, |
|
|
int |
width = 0, |
|
|
int |
height = 0 |
|
) |
| |
Creates sprite based on the texture textureName.
If either width or height are 0, the texture's width and height will be used.
The default values will use the whole texture as a sprite. Calls SlSprite::addDefaultDestination(), so if you don't want to use that, either delete or adjust that destination.
| std::shared_ptr< SlSprite > SlSpriteManager::createSprite |
( |
const std::string & |
name, |
|
|
const std::string & |
textureName, |
|
|
int |
x = 0, |
|
|
int |
y = 0, |
|
|
int |
width = 0, |
|
|
int |
height = 0 |
|
) |
| |
Creates sprite based on the texture textureName.
If either width or height are 0, the texture's width and height will be used.
The default values will use the whole texture as a sprite. Calls SlSprite::addDefaultDestination(), so if you don't want to use that, either delete or adjust that destination.
| void SlSpriteManager::deleteSprite |
( |
const std::string & |
name | ) |
|
Delete the specified sprite and remove from sprites_ .
| void SlSpriteManager::deleteSprites |
( |
const std::string & |
textureName | ) |
|
Delete the sprite that are based on the named SlTexture.
| std::shared_ptr< SlSprite > SlSpriteManager::findSprite |
( |
const std::string & |
name | ) |
|
Returns pointer to the sprite, nullptr if not found.
| void SlSpriteManager::manipulateSprite |
( |
const std::string & |
name, |
|
|
unsigned int |
destination, |
|
|
const std::string & |
whatToDo, |
|
|
const std::vector< std::string > & |
parameters |
|
) |
| |
|
protected |
Move the sprite based on configuration file.\ Currently implemented whatToDo:
setOrigin, centerAt, centerIn, setOptions
| std::map<std::string, SlManipulation*> SlSpriteManager::manipulations |
( |
| ) |
|
|
inline |
Get the map of SlManipulations.
Deleted, same reason as copy constructor.
| void SlSpriteManager::parseSprite |
( |
std::ifstream & |
input | ) |
|
Read sprite configurations from file
| void SlSpriteManager::parseSpriteManipulation |
( |
std::ifstream & |
input | ) |
|
Read sprite placement from file.
| void SlSpriteManager::setSpriteColor |
( |
const std::string & |
name, |
|
|
uint8_t |
red, |
|
|
uint8_t |
green, |
|
|
uint8_t |
blue, |
|
|
uint8_t |
alpha = 0xFF, |
|
|
unsigned int |
destination = 0 |
|
) |
| |
Sets color for SlSprite name at position i of SlSprite::destinations_.
Color is use when using color mod to render, and when creating a texture from a rectangle.
| void SlSpriteManager::setSpriteDestinationOrigin |
( |
const std::string & |
name, |
|
|
int |
x, |
|
|
int |
y, |
|
|
unsigned int |
destination = 0 |
|
) |
| |
| void SlSpriteManager::setSpriteRenderOptions |
( |
const std::string & |
name, |
|
|
uint32_t |
renderOptions, |
|
|
unsigned int |
destination = 0 |
|
) |
| |
| std::map<std::string, SlManipulation*> SlSpriteManager::manipulations_ |
|
private |
Holds the various SlSpriteManipulations for the different tasks. The map key is the name of the manipulation, which is also the keyword used in the configuration file, the mapped value is the object that will do the actual work.
The running SlManager that called the constructor.
| std::vector<std::shared_ptr<SlSprite> > SlSpriteManager::sprites_ |
|
private |
Helper object to translate file input into values.
The documentation for this class was generated from the following files: