view docs/specs/sprite.md @ 182:3107ce017c3a

Misc: switch back to SDL Qt Quick and QML was an exciting experiment but it's definitely not enough flexible and easy to use for game development. Using SDL2 will let us focusing on our own drawing functions without any kind of overhead. While here, start massive cleanup.
author David Demelier <markand@malikania.fr>
date Fri, 19 Oct 2018 20:18:19 +0200
parents
children
line wrap: on
line source

# Sprite

A sprite is an object that splits an image into several cells. It is primarily
designed to combine multiple related images into one for better performance and
easier usage.

Sprites are mostly used as character design, some GUI elements, map tilesets
and other data that require lots of related images.

Sprites can be created natively in C++, Javascript or using the resource loader
with an appropriate JSON description.

## JSON specification

### Synopsis

```json
{
    "image": "image identifier",
    "cell": [ 0, 0 ],
    "margin": [ 0, 0 ],
    "space": [ 0, 0 ],
    "size": [ 50, 50 ]
}
```

### Properties

  - **image**: unique identifier to an image,
  - **cell**: size of sprite cells,
  - **margin**: top/left and bottom/right margins (Optional: default none),
  - **space**:
    space between each cell horizontally/vertically (Optional: default none),
  - **size**: override image size (Optional: default automatic).