-
Notifications
You must be signed in to change notification settings - Fork 20
Format of texture atlas file (sad::resource::TextureAtlasFile, supported from 1.3 )
ahiddenseeker edited this page May 21, 2015
·
1 revision
A texture atlas format is plain JSON file, which must contain JSON object with properties, describing atlas. The object must have properties listed below:
- "resource" - describes a resource name. A loaded texture will be registered under that name.
- "file" - specifies a path to texture, which contains atlas entries.
- "atlas" - an array of texture atlas entry definitions.
A texture atlas entry is a JSON object, which must contain data, needed to create sprite. It must contain following properties:
- "name" - a name, under which it will be registered in resource tree.
- "size" - a default size of sprite in format of
<width>;<height>
, where width and height are valid integral values. - "texrect" - a rectangle of texture coordinates in format of
<x>;<y>;<width>;<height>
, where all values are valid integral values. - "transparent" - non-required attribute, in format of
<red>;<green>;<blue>
, which describes a alpha color mask.
An example could be found in folder
{
"resource": "icons",
"file": "tests/icons.png",
"atlas": [
{
"name": "1",
"size": "300;293",
"texrect": "0;0;300;293",
"transparent": "255;255;255"
},
{
"name": "2",
"size": "200;200",
"texrect": "0;293;200;200",
"transparent": "255;255;255"
},
{
"name": "3",
"size": "256;256",
"texrect": "0;493;256;256",
"transparent": "255;255;255"
},
{
"name": "4",
"size": "300;293",
"texrect": "0;0;300;293",
"transparent": "255;255;255"
},
{
"name": "5",
"size": "300;293",
"texrect": "0;0;300;293",
"transparent": "255;255;255"
},
{
"name": "6",
"size": "300;293",
"texrect": "0;0;300;293",
"transparent": "255;255;255"
}
]
}