Module technology.sola.engine
Class SpriteSheet
java.lang.Object
technology.sola.engine.assets.graphics.spritesheet.SpriteSheet
- All Implemented Interfaces:
Asset
SpriteSheet is an
Asset
for a collection of sprites.-
Constructor Summary
ConstructorsConstructorDescriptionSpriteSheet
(SolaImage solaImage) Creates a new SpriteSheet from aSolaImage
source. -
Method Summary
Modifier and TypeMethodDescriptionaddSpriteDefinition
(String id, int x, int y, int width, int height) Adds a sprite definition to the sprite sheet.addSpriteDefinition
(SpriteInfo spriteInfo) Adds a sprite definition to the sprite sheet.Gets a sprite'sSolaImage
by id.
-
Constructor Details
-
SpriteSheet
Creates a new SpriteSheet from aSolaImage
source.- Parameters:
solaImage
- the source image
-
-
Method Details
-
addSpriteDefinition
Adds a sprite definition to the sprite sheet. This will be a sub-image of the source image that can be retrieved layer by id.- Parameters:
id
- the id of the spritex
- the left most coordinate of the sprite in the source imagey
- the top most coordinate of the sprite in the source imagewidth
- the width of the sprite in the source imageheight
- the height of the sprite in the source image- Returns:
- the sprite's
SolaImage
-
addSpriteDefinition
Adds a sprite definition to the sprite sheet. This will be a sub-image of the source image that can be retrieved layer by id.- Parameters:
spriteInfo
- - theSpriteInfo
for the sprite to add- Returns:
- the sprite's
SolaImage
-
getSprite
Gets a sprite'sSolaImage
by id.- Parameters:
id
- the id of the sprite- Returns:
- the sprite's image
-