XML Packed SpriteSheet

From Slick2D Wiki
Revision as of 13:34, 15 May 2018 by 81.247.3.17 (Talk) (Undo revision 542 by Abc123456 (talk))

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

These kind of sprite sheets are generated by Pack-U-Like (Slick2D's Sprite Packer). Each XMLPackedSheet needs a base Image which contains the packed sprites and a XML-File for it's description (Position, Name, etc).

Usage[edit]

Create a new Sheet:

XMLPackedSheet sheet = new XMLPackedSheet("res/sheet.png", "res/sheet.xml");

Get a Sprite:

Image image = sheet.getImage("someImage");

When images are loaded into the Pack-U-Like tool, the name of the image is set to the name of the image file which has been loaded. When referencing the image using the getImage method above, someImage refers to the image name (filename) of the image which was loaded into the packed sheet.

See Also[edit]