- nom
- SpriteSheet
Specialized class container for the creation of sprite sheets via RFC 4627 JSON-compliant file input. More...
#include <SpriteSheet.hpp>
Public Types | |
|
typedef std::shared_ptr < SpriteSheet > | SharedPtr |
Public Member Functions | |
| SpriteSheet (void) | |
| ~SpriteSheet (void) | |
| Destructor. | |
| SpriteSheet (const std::string &filename) | |
| Construct a sprite sheet from an existing sprite sheet file. | |
| SpriteSheet (const std::string &filename, int32 sheet_width, int32 sheet_height, int32 sprite_width, int32 sprite_height, int32 spacing, int32 padding, int32 num_sprites) | |
| SpriteSheet::SharedPtr | clone (void) const |
| Make a duplicate of this object's instance. | |
| const Coords & | dimensions (int32 index) const |
| Get the calculations made for a particular ID number. | |
| int32 | frames (void) const |
| Obtain the number of frames this object contains. | |
| const std::string & | sheet_filename (void) const |
| bool | save (const std::string &filename) |
| bool | load (const std::string &filename) |
| void | dump (void) const |
| Dump the state of this object instance. | |
Private Attributes | |
| std::vector< Coords > | sheet |
| Our sprite sheet values container. | |
| std::string | sheet_filename_ |
| Source filename used is saved with the output (meta-data) | |
| int32 | sheet_sprites |
| int32 | sheet_spacing |
| Source spacing used is saved with the output (meta-data) | |
| int32 | sheet_padding |
| Source padding used is saved with the output (meta-data) | |
| int32 | sheet_width |
| Source sheet_width used is saved with the output (meta-data) | |
| int32 | sheet_height |
| Source sheet_height used is saved with the output (meta-data) | |
Specialized class container for the creation of sprite sheets via RFC 4627 JSON-compliant file input.
[DESCRIPTION STUB]
Usage example:
Definition at line 62 of file SpriteSheet.hpp.
| nom::SpriteSheet::SpriteSheet | ( | void | ) |
Default construct for initializing instance variables to their respective defaults.
Definition at line 37 of file SpriteSheet.cpp.
| nom::SpriteSheet::SpriteSheet | ( | const std::string & | filename, |
| int32 | sheet_width, | ||
| int32 | sheet_height, | ||
| int32 | sprite_width, | ||
| int32 | sprite_height, | ||
| int32 | spacing, | ||
| int32 | padding, | ||
| int32 | num_sprites | ||
| ) |
Construct a sprite sheet from a given list of arguments. The total tile count is used if the num_sprites argument is not initialized.
The filename specified is used only as meta-data.
Padding is applied on all four sides. Spacing is applied between each tile.
Re-order these arguments to match the order of instance variables
Add additional sanity-check asserts for spacing, padding and so on
Definition at line 56 of file SpriteSheet.cpp.
| bool nom::SpriteSheet::load | ( | const std::string & | filename | ) |
Load saved sprite sheet data from a file encoded as an RFC 4627 compliant JSON object.
Definition at line 220 of file SpriteSheet.cpp.
| bool nom::SpriteSheet::save | ( | const std::string & | filename | ) |
Save the current sprite sheet data calculations to a file as a series of RFC 4627 compliant JSON objects.
Definition at line 182 of file SpriteSheet.cpp.
|
private |
Source number of sprites specified; this is saved with the resulting output as meta-data
Definition at line 126 of file SpriteSheet.hpp.