bluegammon.gui.animation
Class AnimationEngine

java.lang.Object
  extended bybluegammon.gui.animation.AnimationEngine
All Implemented Interfaces:
java.lang.Runnable

public class AnimationEngine
extends java.lang.Object
implements java.lang.Runnable

Animation engine, handles all animation logic. Works together with an implementation of a RepaintRequestable This animation engine uses a primitive mechanism when deciding what interval to update all animations - it uses the minimum interval value returned amongst all active animations in the engine. Hence, all animations should return a common least denominator in their getInterval().

Author:
Peter Andersson

Constructor Summary
AnimationEngine(RepaintRequestable canvas)
          Creates an animation engine for specified canvas.
 
Method Summary
 void addAnimation(Animation a)
          Adds an animation.
 void paint(javax.microedition.lcdui.Graphics g)
          Paints all animations on specified graphics context
 void remove(Animation anim)
          Removes an animation.
 void removeAll()
          Removes all animations
 void run()
          Updates all animations in queue if needed, and waits minimum amount of time as declared by animations.
 void shutdown()
          Shuts down the animation engine.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationEngine

public AnimationEngine(RepaintRequestable canvas)
Creates an animation engine for specified canvas.

Parameters:
canvas - The canvas that will be animated upon.
Method Detail

addAnimation

public void addAnimation(Animation a)
Adds an animation.

Parameters:
a - The animation to add

remove

public void remove(Animation anim)
Removes an animation.

Parameters:
anim - The animation to remove

removeAll

public void removeAll()
Removes all animations


shutdown

public void shutdown()
Shuts down the animation engine.


paint

public void paint(javax.microedition.lcdui.Graphics g)
Paints all animations on specified graphics context

Parameters:
g - The graphics context

run

public void run()
Updates all animations in queue if needed, and waits minimum amount of time as declared by animations.

Specified by:
run in interface java.lang.Runnable