Class Spritesheet
java.lang.Object
de.gurkenlabs.litiengine.graphics.Spritesheet
- All Implemented Interfaces:
Comparable<Spritesheet>
-
Constructor Summary
ConstructorsConstructorDescriptionSpritesheet(BufferedImage image, String path, int spriteWidth, int spriteHeight) Instantiates a newSpritesheetinstance. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(Spritesheet obj) intGets the sprites per row.getImage()getName()The unique name of this spritesheet.getPreview(int dimension) intgetRows()getSprite(int index) getSprite(int index, int margin, int spacing) intGets the sprite height.intGets the sprite width.intGets the total sprites.booleanisLoaded()voidsetSpriteHeight(int spriteHeight) voidsetSpriteWidth(int spriteWidth)
-
Constructor Details
-
Spritesheet
Instantiates a newSpritesheetinstance. Depending on the givenspriteWidthandspriteHeight, the sub-images will be cropped from the spritesheet image when accessing individual sprites.- Parameters:
image- the spritesheet imagepath- the path (or name) of the spritesheet imagespriteWidth- the width in pixels of each sprite in the spritesheet.spriteHeight- the height in pixels of each sprite in the spritesheet.
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<Spritesheet>
-
getColumns
public int getColumns()Gets the sprites per row.- Returns:
- the sprites per row
-
getPreview
-
getImage
-
getImageFormat
-
getName
The unique name of this spritesheet. A spritesheet can always be identified by this name within a game project.- Returns:
- The name of the spritesheet.
-
getRows
public int getRows() -
getRandomSprite
-
getSprite
-
getSprite
-
getSpriteHeight
public int getSpriteHeight()Gets the sprite height.- Returns:
- the sprite height
-
getSpriteWidth
public int getSpriteWidth()Gets the sprite width.- Returns:
- the sprite width
-
getTotalNumberOfSprites
public int getTotalNumberOfSprites()Gets the total sprites.- Returns:
- the total sprites
-
isLoaded
public boolean isLoaded() -
setSpriteHeight
public void setSpriteHeight(int spriteHeight) -
setSpriteWidth
public void setSpriteWidth(int spriteWidth)
-