Package tripleplay.util
Class SimpleFrames
java.lang.Object
tripleplay.util.SimpleFrames
- All Implemented Interfaces:
Frames
A simple implementation of
Frames
that uses an untrimmed horizontal strip image.-
Constructor Summary
ConstructorDescriptionSimpleFrames
(Tile source, float width) Creates an instance with the supplied source texture.SimpleFrames
(Tile source, float width, float height) Creates an instance with the supplied source texture.SimpleFrames
(TileSource source, float width, float height, int count) Creates an instance with the supplied tile source. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(int index, ImageLayer layer) Configures the supplied image layer with the specified frame.pythagoras.f.IRectangle
bounds
(int index) Returns the bounds for the specified frame.int
count()
Returns the number of frames available.float
height()
Returns the height of a logical frame.pythagoras.f.IPoint
offset
(int index) Returns the offset (into the logical bounds) of the specified frame.float
width()
Returns the width of a logical frame.
-
Constructor Details
-
SimpleFrames
Creates an instance with the supplied source texture. The frames are assumed to be all in a single row, thus the height of the image defines the height of the frame.- Parameters:
width
- the width of each frame.
-
SimpleFrames
Creates an instance with the supplied source texture. The image is assumed to contain a complete sheet of frames, eachwidth x height
in size.- Parameters:
width
- the width of each frame.height
- the width of each frame.
-
SimpleFrames
Creates an instance with the supplied tile source. The tile is assumed to containcount
frames, eachwidth x height
in size, in row major order (any missing frames are on the right side of the bottom row).- Parameters:
width
- the width of each frame.height
- the width of each frame.
-
-
Method Details
-
width
public float width()Description copied from interface:Frames
Returns the width of a logical frame. -
height
public float height()Description copied from interface:Frames
Returns the height of a logical frame. -
count
public int count()Description copied from interface:Frames
Returns the number of frames available. -
bounds
public pythagoras.f.IRectangle bounds(int index) Description copied from interface:Frames
Returns the bounds for the specified frame. -
offset
public pythagoras.f.IPoint offset(int index) Description copied from interface:Frames
Returns the offset (into the logical bounds) of the specified frame. -
apply
Description copied from interface:Frames
Configures the supplied image layer with the specified frame. The layer's image will be updated and the layer's translation will be adjusted to the requested frame's offset
-