|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmhframework.media.MHImageGroup
public final class MHImageGroup
Maintains a complete set of animation sequences (MHFrameSequence objects) for a particular type of actor (MHActor).
Objects requiring groups of images can instantiate an MHImageGroup and use it for all sprite animation capabilities. Client classes are encouraged to keep their own sequence ID numbers, and are required to track their own sequences and frame numbers.
These classes are organized in a composition hierarchy like this:
How to use this system:
Constructor Summary | |
---|---|
MHImageGroup()
Constructor. |
Method Summary | |
---|---|
void |
addFrame(int sequenceID,
java.awt.Image newImage,
int duration)
Adds an animation frame to an existing frame sequence |
void |
addFrame(int sequenceID,
java.lang.String imageFile,
int duration)
Adds an animation frame to an existing frame sequence. |
void |
addSequence(int sequenceID)
Adds a new animation sequence to an image group. |
int |
getDuration(int sequenceID,
int frameNumber)
Returns the duration of the specified frame. |
int |
getFrameCount(int sequenceID)
Returns the number of frames in the specified sequence. |
java.awt.Image |
getImage(int sequenceID,
int frameNumber)
Returns the requested image from the image group. |
int |
getNumSequences()
Returns the number of animation sequences in this image group. |
static java.awt.Image |
loadImage(java.lang.String imageFile)
|
boolean |
sequenceExists(int sequenceID)
|
void |
setDuration(int sequenceID,
int frameNumber,
int newDuration)
Sets the duration of the specified frame. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MHImageGroup()
Method Detail |
---|
public void addFrame(int sequenceID, java.lang.String imageFile, int duration)
sequenceID
- The sequence to which the frame is to be
added.imageFile
- The name of the image file containing the
image to be used for the animation frame.duration
- The duration in loop iterations for which
this frame is shown before advancing to
the next frame.public static java.awt.Image loadImage(java.lang.String imageFile)
public void addFrame(int sequenceID, java.awt.Image newImage, int duration)
sequenceID
- The sequence to which the frame is to be
added.newImage
- The image to be used for the animation
frame.duration
- The duration in loop iterations for which
this frame is shown before advancing to
the next frame.public void addSequence(int sequenceID)
sequenceID
- The number of the sequence to be added.public boolean sequenceExists(int sequenceID)
public java.awt.Image getImage(int sequenceID, int frameNumber)
public int getDuration(int sequenceID, int frameNumber)
public void setDuration(int sequenceID, int frameNumber, int newDuration)
public int getFrameCount(int sequenceID)
sequenceID
- The ID number of the sequence whose frame
count is requested.
public int getNumSequences()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |