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- theSpriteInfodefinitions 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 aSpriteSheetInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionaddSprite(SpriteInfo newSpriteInfo) Adds a new sprite to the sprite sheet and returns a new instance.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()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 thespritesrecord component.Returns the value of thespriteSheetrecord component.final StringtoString()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 aSpriteSheetInforecord class.- Parameters:
spriteSheet- the value for thespriteSheetrecord componentsprites- the value for thespritesrecord component
-
-
Method Details
-
addSprite
Adds a new sprite to the sprite sheet and returns a new instance.- Parameters:
newSpriteInfo- theSpriteInfoof the new sprite- Returns:
- a new
SpriteSheetInfoinstance 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 newSpriteInfofor the sprite- Returns:
- a new
SpriteSheetInfoinstance 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
SpriteSheetInfoinstance 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 thespriteSheetrecord component.- Returns:
- the value of the
spriteSheetrecord component
-
sprites
Returns the value of thespritesrecord component.- Returns:
- the value of the
spritesrecord component
-