Use a sprite sheet for 2d animations. The sprite sheet parameters are defined in a additional file to the bitmap file in JSON format. The file shall have the file extension ".sprite".
Example of a fire animation (see ./doc/spritesheet/example):
{
"texture": {
"width": 40,
"height": 8,
"frames": 5,
"frame": {
"width": 8,
"height": 8
},
"fps": 5,
"repeat": true
}
}
The texture describes the bitmap texture which contains one or usually several sprites. The bounding box of a sprite is called frame.
Because a texture may not be filled with sprites, the number of frames (frames) is given. If the number of frames is not given, it will be assumed that the texture is completely filled.
The order of each frame is from top left to the right and in the next row again from left to right and so on. If not further specified, it will be automatically repeated. If only on animation cycle is required, it will be specified with repeat by setting it to "false".
The frames per second (fps) specifiy how fast the animation runs.
Use the ./doc/spritesheet/create_sprite_sheet.py
to create it or manually.
- Only .bmp format is currently supported, uncompressed and without color palette.
If you have further ideas or you found some bugs, great! Create a issue or if you are able and willing to fix it by yourself, clone the repository and create a pull request.
The whole source code is published under the MIT license. Consider the different licenses of the used third party libraries too!
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.