animation
Class AnimationScheduler

java.lang.Object
  extended by animation.AnimationScheduler
All Implemented Interfaces:
java.io.Serializable

public class AnimationScheduler
extends java.lang.Object
implements java.io.Serializable

This class can be used to schedule animation sequences

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
AnimationScheduler(AbstractGameObject go)
           
 
Method Summary
 void add(java.lang.String name)
          Adds an animation with infinite duration to the queue.
 void add(java.lang.String name, long dur)
          Adds an animation to the queue
 void clear()
          Deletes the animations of the processing queue.
 void forceNext()
          Sets the animation scheduler to the next animation.
 java.lang.String getCurrAnimName()
          Returns the reference name of the currently active animation on schedule
 java.lang.String getNextAnimName()
          Returns the name of the animation that follows on the current animation in the animation scheduler queue.
 java.util.LinkedList<Animation> getQueue()
          Returns the queue of the animation scheduler
 void next()
          Sets the animation scheduler to the next animation.
 void pause()
          Stops the processing of the animation queue
 void removeFirst()
          Removes the first element (current animation) from the animation queue, if there is one
 void resume()
          Resumes the schedule
 void start()
          Starts the processing of the animation queue from the beginning
 void update(long elapsedTime)
          Updates the animation schedule
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationScheduler

public AnimationScheduler(AbstractGameObject go)
Method Detail

add

public void add(java.lang.String name,
                long dur)
Adds an animation to the queue

Parameters:
name - animation reference name
dur - animation duration in miliseconds

add

public void add(java.lang.String name)
Adds an animation with infinite duration to the queue. Such animation can only be eliminated from the queue by clearing the whole queue with the clear() method

Parameters:
name - animation refrence name

getCurrAnimName

public java.lang.String getCurrAnimName()
Returns the reference name of the currently active animation on schedule

Returns:
constant of the active animation

getNextAnimName

public java.lang.String getNextAnimName()
Returns the name of the animation that follows on the current animation in the animation scheduler queue. If there is none the method return null

Returns:
name of the following (second) animation in the queue

removeFirst

public void removeFirst()
Removes the first element (current animation) from the animation queue, if there is one


start

public void start()
Starts the processing of the animation queue from the beginning


pause

public void pause()
Stops the processing of the animation queue


resume

public void resume()
Resumes the schedule


clear

public void clear()
Deletes the animations of the processing queue.


next

public void next()
Sets the animation scheduler to the next animation. Only is effective if there actually _is_ another animation on schedule. Animations that were set to run infintely will not be skipped for the next animation.


forceNext

public void forceNext()
Sets the animation scheduler to the next animation. Only is effective if there actually _is_ another animation on schedule. Compared to the simple next() method this method is able to even skip an animation that was set to run inifitely. animation.


getQueue

public java.util.LinkedList<Animation> getQueue()
Returns the queue of the animation scheduler

Returns:
animation scheduler queue

update

public void update(long elapsedTime)
Updates the animation schedule

Parameters:
elapsedTime - time between two frames