Difference between revisions of "XML Packed SpriteSheet"
From Slick2D Wiki
Line 16: | Line 16: | ||
* [[SpriteSheet]] | * [[SpriteSheet]] | ||
* [[Packed Sprite Sheets]] | * [[Packed Sprite Sheets]] | ||
+ | |||
+ | [[Category:Sprites]] |
Revision as of 17:10, 8 August 2013
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
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.