Skip to content

Old texture atlas file format (up to 1.2 version)

ahiddenseeker edited this page May 21, 2015 · 1 revision

Introduction

An old versions had two types of files - a resource file and file with texture atlas. A resource files described a list of texture atlases and a fonts (only TTF fonts were supported)

Resource file format

A resource file format, an example of which will be file located at $SADDY$/bin/ifaceed/globalconfig.xml. It's a simple xml file, which consists of global node named, "globalconfig". Global config section could contain two types of node - a font node with required attributes name - a name attribute, which could be used in window of IFaceEditor and a file attribute, which describes file, where are font is located.

An example of such node is listed below:

<font name="MyFont" file="1.TTF" />

This node described a font with name MyFont, located in file 1.TTF

A second type of node is texture atlas node, named as "config". It describes a texture atlas file, and has same attribute name, which names a loaded texture atlas and also attribute file, file, where atlas is located. A short example of such node is:

<config  name="Test" file="textures.xml" />

And example of valid resource file is:

<globalconfig>
  <font name="MyFont" file="1.TTF" />
  <config  name="Test" file="textures.xml" />
</globalconfig>

Texture Atlas File Format

A texture atlas file is and XML file, which consists of global node "sprites" with one or several subnodes, named by specified name of node.

It must contain several attributes:

  • texture - describes a texture file location.
  • size - describes a default size of sprite, which is bind to this entry. It described in format "<width>;<height>", where width and height are valid integral values
  • texrect - describes a texture coordinates rectangle for entries in format "<x>;<y>;<width>;<height>", where all values are integral values
  • transparent - non-required attribute, which describes transparent color mask, which is applied to texture region in format "<red>;<blue>;<green>", where all values are intgral in rangle of 0-255

Also in one file, allowed values from different texture files. An example of valid file is listed below:

<sprites>
  <test1-dev texture='textures.png' size='300;293' texrect='500;0;300;293'/>
  <test2-dev index='2' texture='textures.png' size='200;200' texrect='500;293;200;200'/>
  <test2-dev texture='textures.png' size='64;64' texrect='500;293;200;200'/>
  <test3-dev texture='textures.png' size='64;120' texrect='0;0;500;588' transparent='120;120;120'/>
  <test4-dev texture='textures.png' size='256;256' texrect='500;493;256;256' transparent='120;120;120'/>
</sprites>