XML Packed SpriteSheet

From Slick2D Wiki
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]