Module technology.sola.engine
Record Class SpriteSheetInfo
java.lang.Object
java.lang.Record
technology.sola.engine.assets.graphics.spritesheet.SpriteSheetInfo
- Record Components:
spriteSheet
- the path to the spritesheet's imagesprites
- theSpriteInfo
definitions within the spritesheet
@NullMarked
public record SpriteSheetInfo(String spriteSheet, List<SpriteInfo> sprites)
extends Record
Contains information about a spritesheet.
-
Constructor Summary
ConstructorsConstructorDescriptionSpriteSheetInfo
(String spriteSheet, List<SpriteInfo> sprites) Creates an instance of aSpriteSheetInfo
record class. -
Method Summary
Modifier and TypeMethodDescriptionaddSprite
(SpriteInfo newSpriteInfo) Adds a new sprite to the sprite sheet and returns a new instance.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.removeSprite
(String id) Removes a sprite by its id from this sprite sheet and returns a new instance.sprites()
Returns the value of thesprites
record component.Returns the value of thespriteSheet
record component.final String
toString()
Returns a string representation of this record class.updateSprite
(String id, SpriteInfo newSpriteInfo) Updates a sprite by id and returns a new instance.
-
Constructor Details
-
SpriteSheetInfo
Creates an instance of aSpriteSheetInfo
record class.- Parameters:
spriteSheet
- the value for thespriteSheet
record componentsprites
- the value for thesprites
record component
-
-
Method Details
-
addSprite
Adds a new sprite to the sprite sheet and returns a new instance.- Parameters:
newSpriteInfo
- theSpriteInfo
of the new sprite- Returns:
- a new
SpriteSheetInfo
instance with the sprite added
-
updateSprite
Updates a sprite by id and returns a new instance.- Parameters:
id
- the id of the sprite to updatenewSpriteInfo
- the newSpriteInfo
for the sprite- Returns:
- a new
SpriteSheetInfo
instance with the sprite updated
-
removeSprite
Removes a sprite by its id from this sprite sheet and returns a new instance.- Parameters:
id
- the id of the sprite to remove- Returns:
- a new
SpriteSheetInfo
instance with the sprite removed
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
spriteSheet
Returns the value of thespriteSheet
record component.- Returns:
- the value of the
spriteSheet
record component
-
sprites
Returns the value of thesprites
record component.- Returns:
- the value of the
sprites
record component
-