Class SpritesheetResource

java.lang.Object
de.gurkenlabs.litiengine.resources.NamedResource
de.gurkenlabs.litiengine.resources.SpritesheetResource
All Implemented Interfaces:
Resource, Serializable, Comparable<Resource>

public class SpritesheetResource extends NamedResource implements Serializable

Represents a resource for managing spritesheets.

This class extends the NamedResource class and implements Serializable to provide specific functionality for handling spritesheet resources.

See Also:
  • Field Details

  • Constructor Details

    • SpritesheetResource

      public SpritesheetResource()

      Default constructor for SpritesheetResource.

      This constructor is kept for serialization purposes.

    • SpritesheetResource

      public SpritesheetResource(Spritesheet sprite)

      Constructs a new SpritesheetResource from a Spritesheet object.

      This constructor initializes the SpritesheetResource with the specified sprite's width, height, name, image, image format, and keyframes.

      Parameters:
      sprite - The Spritesheet object to initialize the resource from.
    • SpritesheetResource

      public SpritesheetResource(SpritesheetResource original)
    • SpritesheetResource

      public SpritesheetResource(BufferedImage image, String name, int width, int height)

      Constructs a new SpritesheetResource from a BufferedImage.

      This constructor initializes the SpritesheetResource with the specified image, name, width, and height.

      Parameters:
      image - The BufferedImage to initialize the resource from.
      name - The name of the spritesheet.
      width - The width of the spritesheet.
      height - The height of the spritesheet.
  • Method Details

    • copyFrom

      public void copyFrom(SpritesheetResource original)
    • getHeight

      public int getHeight()
      Gets the height of the spritesheet.
      Returns:
      The height of the spritesheet.
    • getImage

      public String getImage()
      Gets the image data of the spritesheet.
      Returns:
      The image data of the spritesheet.
    • getWidth

      public int getWidth()
      Gets the width of the spritesheet.
      Returns:
      The width of the spritesheet.
    • getImageFormat

      public ImageFormat getImageFormat()
      Gets the image format of the spritesheet.
      Returns:
      The image format of the spritesheet.
    • getKeyframes

      public int[] getKeyframes()
      Gets the keyframes of the spritesheet.
      Returns:
      An array of keyframes of the spritesheet.
    • setHeight

      public void setHeight(int h)
      Sets the height of the spritesheet.
      Parameters:
      h - The height to set.
    • setImage

      public void setImage(String image)
      Sets the image data of the spritesheet.
      Parameters:
      image - The image data to set.
    • setWidth

      public void setWidth(int w)
      Sets the width of the spritesheet.
      Parameters:
      w - The width to set.
    • setImageFormat

      public void setImageFormat(ImageFormat f)
      Sets the image format of the spritesheet.
      Parameters:
      f - The image format to set.
    • setKeyframes

      public void setKeyframes(int[] keyframes)
      Sets the keyframes of the spritesheet.
      Parameters:
      keyframes - An array of keyframes to set.