bluegammon.gui.animation
Class AbstractDicesAnim

java.lang.Object
  extended bybluegammon.gui.animation.Animation
      extended bybluegammon.gui.animation.AbstractDicesAnim
Direct Known Subclasses:
DicesNewTurnAnim, DicesSelectTurnAnim

public abstract class AbstractDicesAnim
extends Animation

An abstract animation of two dices - we do not have a case where we ever show only one dice. This is an general handler for rolling two dices that will have specified color and dice-value each.

Author:
Peter Andersson

Constructor Summary
AbstractDicesAnim(boolean dice1White, boolean dice2White, int dice1Val, int dice2Val)
          Initiates this animation.
 
Method Summary
 long getInterval()
          Returns interval time in milliseconds when the animation should be updated, i.e. the next method is invoked.
static void init(int factor)
          Initializes this animation, must be called before displaying any diceanimations.
 boolean isFinished()
          Probes to check if the animation can be removed
 void next()
          Called each time the animation should be updated.
 void onStart()
          Called when the animation starts, resets the state of the sound.
 void paint(javax.microedition.lcdui.Graphics g)
          Draws the animation using the specified graphics context.
 
Methods inherited from class bluegammon.gui.animation.Animation
callNext, getLastInvoke, onExit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDicesAnim

public AbstractDicesAnim(boolean dice1White,
                         boolean dice2White,
                         int dice1Val,
                         int dice2Val)
Initiates this animation. Specifies color and values for both dices.

Parameters:
dice1White - True if left dice is white, false for black,
dice2White - True if right dice is white, false for black,
dice1Val - Left dice value, 1 to 6.
dice2Val - Right dice value, 1 to 6.
Method Detail

init

public static void init(int factor)
Initializes this animation, must be called before displaying any diceanimations.

Parameters:
factor - The size factor of the dices, depends on the canvas size of the device.

onStart

public void onStart()
Called when the animation starts, resets the state of the sound.

Overrides:
onStart in class Animation

paint

public void paint(javax.microedition.lcdui.Graphics g)
Description copied from class: Animation
Draws the animation using the specified graphics context.

Specified by:
paint in class Animation
Parameters:
g - The graphics context.

next

public void next()
Description copied from class: Animation
Called each time the animation should be updated.

Specified by:
next in class Animation

isFinished

public boolean isFinished()
Description copied from class: Animation
Probes to check if the animation can be removed

Specified by:
isFinished in class Animation
Returns:
true if finished, false if still active

getInterval

public long getInterval()
Description copied from class: Animation
Returns interval time in milliseconds when the animation should be updated, i.e. the next method is invoked.

Specified by:
getInterval in class Animation
Returns:
update interval in milliseconds.