java.lang.Object
technology.sola.engine.assets.graphics.spritesheet.SpriteSheet
All Implemented Interfaces:
Asset

@NullMarked public class SpriteSheet extends Object implements Asset
SpriteSheet is an Asset for a collection of sprites.
  • Constructor Details

    • SpriteSheet

      public SpriteSheet(SolaImage solaImage)
      Creates a new SpriteSheet from a SolaImage source.
      Parameters:
      solaImage - the source image
  • Method Details

    • addSpriteDefinition

      public SolaImage addSpriteDefinition(String id, int x, int y, int width, int height)
      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 sprite
      x - the left most coordinate of the sprite in the source image
      y - the top most coordinate of the sprite in the source image
      width - the width of the sprite in the source image
      height - the height of the sprite in the source image
      Returns:
      the sprite's SolaImage
    • addSpriteDefinition

      public SolaImage addSpriteDefinition(SpriteInfo spriteInfo)
      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 - - the SpriteInfo for the sprite to add
      Returns:
      the sprite's SolaImage
    • getSprite

      public SolaImage getSprite(String id)
      Gets a sprite's SolaImage by id.
      Parameters:
      id - the id of the sprite
      Returns:
      the sprite's image