![]() |
xyginext
0.2.0
Second generation of xygine game creation framework
|
Supports loading multiple sprites from a single texture atlas via the ConfigFile format. More...
#include <SpriteSheet.hpp>
Public Member Functions | |
bool | loadFromFile (const std::string &path, TextureResource &rx) |
Attempts to load a ConfigFile from the given path. A reference to a valid texture resource is required to load the sprite sheet texture. More... | |
bool | loadFromFile (const std::string &path, ResourceHandler &rx) |
bool | saveToFile (const std::string &path) |
Attempts to save a ConfigFile at the given path. More... | |
Sprite | getSprite (const std::string &name) const |
Returns a sprite component with the given name as it appears in the sprite sheet. If the sprite does not exist an empty sprite is returned. | |
void | setSprite (const std::string &name, const Sprite &data) |
Set the data of a sprite in the spritesheet. More... | |
void | removeSprite (const std::string &name) |
Remove a sprite from the sheet. | |
const std::unordered_map< std::string, Sprite > & | getSprites () const |
Returns all sprites in this spritesheet. | |
std::size_t | getAnimationIndex (const std::string &name, const std::string &sprite) const |
Returns the index of the animation with the given name on the given sprite if it exists, else returns 0. | |
const std::string & | getTexturePath () const |
Returns the path of the texture used by this spritesheet. | |
void | setTexturePath (const std::string &path) |
Set the path of the texture used by this spritesheet. | |
Supports loading multiple sprites from a single texture atlas via the ConfigFile format.
bool xy::SpriteSheet::loadFromFile | ( | const std::string & | path, |
TextureResource & | rx | ||
) |
Attempts to load a ConfigFile from the given path. A reference to a valid texture resource is required to load the sprite sheet texture.
bool xy::SpriteSheet::saveToFile | ( | const std::string & | path | ) |
Attempts to save a ConfigFile at the given path.
void xy::SpriteSheet::setSprite | ( | const std::string & | name, |
const Sprite & | data | ||
) |
Set the data of a sprite in the spritesheet.
name | The name of the sprite to set |
data | The sprite component data to assign |