SpriteRegion class final
Which piece of which asset a sprite draws.
A region states where its frames sit, so it answers against whatever the cache holds now. It is cut into a SpriteEntry once, and again only when the image behind it changes.
SpriteRegion('assets/slime.png', .all(56), row: 3, end: 12);
Constructors
- SpriteRegion(String asset, Vector2 cell, {int? row, int? start, int? end})
-
Describes a piece of the image cached at
asset, cut intocellframes.factory - SpriteRegion.whole(String asset)
-
Describes the whole of the image cached at
asset, as one frame.const
Properties
- asset → String
-
The cache key the frames are cut from.
final
- cell → Vector2
-
The size of one frame, which is the whole image where none was stated.
no setter
- columns → int
-
How many columns of frames the image holds.
no setter
- end → int?
-
The column played up to, or null to run to the end of the row.
final
- fits → bool
-
Whether this region still fits the cached image.
no setter
- frames → int
-
How many frames this plays.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- image → Image
-
The image this is cut from, as the cache holds it now.
no setter
- isLoaded → bool
-
Whether the cache still holds the art this is cut from.
no setter
- row → int
-
The row of the grid the frames sit on.
final
- rows → int
-
How many rows of frames the image holds.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- start → int
-
The first column played, counted from the start of the row.
final
Methods
-
cut(
) → List< Rect> - One Rect per frame, against the image the cache holds now.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited