Menu

File_format

Christian Henz

File format

Subsurfer stores it's data in XML files.

1.1 Example

<spriteset>
    <texture source="sprites.png" />
    <sprite x="33" y="0" w="32" h="38" label="SOME_SPRITE" />
    <sprite x="32" y="75" w="16" h="14" label="ANOTHER_SPRITE" />
</spriteset>

1.2 Animation example

<spriteset>

    <texture source="sprites.png" />

    <sprite  x="0" y="0" w="24" h="32" label="WALK_0" />
    <sprite x="24" y="0" w="24" h="32" label="WALK_1" />
    <sprite x="48" y="0" w="24" h="32" label="WALK_2" />

    <animation label="WALKING">
      <sequence x="0" y="0" >
        <sprite index="0" delay="0" x="0" y="0" />
        <sprite index="1" delay="0" x="0" y="0" />
        <sprite index="0" delay="0" x="0" y="0" />
        <sprite index="2" delay="0" x="0" y="0" />
        <goto position="0" />
      </sequence>
    </animation>

</spriteset>

2. XML Format

2.1 <spriteset>

The root element.

2.1.1 <texture>

Exactly one texture element is required per spriteset.

Attributes:

  • source - An image filename. The filename is interpreted as relative to the XML document's location.

2.1.2 <sprite>

Sprite elements represent sub-images of the image files. Zero or more elements can occur.

Attributes:

  • x - Position of the sprite in the image, x-coordinate
  • y - Position of the sprite in the image, y-coordinate
  • w - Width of the sprite
  • h - Height of the sprite
  • label (optional) - A text label associated with the sprite. Should be unique among all sprites. Used for header export.

2.1.3 <animation>

An animation. Zero or more elements can occur.

Attributes:

  • label (optional) - A text label associated with the animation. Should be unique among all animations. Used for header export.

2.1.3.1 <sequence>

An animation sequence. Zero or more elements can occur.

Attributes:

  • x - X-offset of the sequence (relative to animation)
  • y - Y-offset of the sequence (relative to animation)

2.1.3.1.1 <sprite>

Note: This should be changed to a unique element name.
"frame", "spriteFrame"

A "sprite" animation element. Zero or more elements can occur.

Attributes:

  • index - The index of the sprite (int).
  • delay - Specifies for how many frames the sprite is displayed (int).
  • x - X-offset of the sprite (relative to sequence)
  • y - Y-offset of the sprite (relative to sequence)

2.1.3.1.2 <goto>

A "goto" animation element. Zero or more elements can occur.

Attributes:

  • position - The index of the sequence element to jump to

2.2 Subsurfer metadata

This section specifies metadata for Subsurfer

The metadata is encapsulated by a XML namespace

<spriteset xmlns:ss="http://subsurfer.sourceforge.net/">

2.2.1 <ss:option>

Attributes:

  • name - Option name
  • value - Option value

Options include:

  • "player.x" - X offset in the animation player (int)
  • "player.y" - Y offset in the animation player (int)
  • "player.fps" - FPS for the animation player (int)
  • "color.background" - Background color (hex #RRGGBB)
  • "color.marker" - Marker color (hex #RRGGBB)
  • "color.selection" - Selection color (hex #RRGGBB)
  • "color.boxes" - Sprite boxes color (hex #RRGGBB)
  • "view.boxes" - Show sprite boxes ("true")
  • "view.zoom" - Zoom factor (int)

Related

Wiki: Main_Page

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.