Class SpritesheetResource
java.lang.Object
de.gurkenlabs.litiengine.resources.NamedResource
de.gurkenlabs.litiengine.resources.SpritesheetResource
- All Implemented Interfaces:
Resource, Serializable, Comparable<Resource>
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for SpritesheetResource.SpritesheetResource(Spritesheet sprite) Constructs a new SpritesheetResource from a Spritesheet object.SpritesheetResource(SpritesheetResource original) SpritesheetResource(BufferedImage image, String name, int width, int height) Constructs a new SpritesheetResource from a BufferedImage. -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyFrom(SpritesheetResource original) intGets the height of the spritesheet.getImage()Gets the image data of the spritesheet.Gets the image format of the spritesheet.int[]Gets the keyframes of the spritesheet.intgetWidth()Gets the width of the spritesheet.voidsetHeight(int h) Sets the height of the spritesheet.voidSets the image data of the spritesheet.voidSets the image format of the spritesheet.voidsetKeyframes(int[] keyframes) Sets the keyframes of the spritesheet.voidsetWidth(int w) Sets the width of the spritesheet.Methods inherited from class NamedResource
getName, setName
-
Field Details
-
PLAIN_TEXT_FILE_EXTENSION
- See Also:
-
-
Constructor Details
-
SpritesheetResource
public SpritesheetResource()Default constructor for SpritesheetResource.
This constructor is kept for serialization purposes.
-
SpritesheetResource
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
-
SpritesheetResource
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
-
getHeight
public int getHeight()Gets the height of the spritesheet.- Returns:
- The height of the spritesheet.
-
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
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
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
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.
-