wyvern.util
Class GameTimers

java.lang.Object
  extended bywyvern.util.GameTimers

public class GameTimers
extends java.lang.Object

A lightweight timer that can be used for animation in the map editor.

Version:
1.0, Jan 18, 2003
Author:
Steve Yegge

Field Summary
static boolean DEBUG
           
 
Constructor Summary
GameTimers()
           
 
Method Summary
static void killTimer(Timer timer)
          Kills a timer.
static Timer setRepeatingTimer(long delay, long period, Timed callback)
          Registers a repeating timer to start after the specified delay.
static Timer setRepeatingTimer(long period, Timed callback)
          Registers a repeating timer.
static Timer setTimer(long delay, Timed callback)
          Registers a one-shot timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

GameTimers

public GameTimers()
Method Detail

setTimer

public static Timer setTimer(long delay,
                             Timed callback)
Registers a one-shot timer. This method will throw an IllegalArgumentException if any of the following conditions is true:

Parameters:
delay - the timer delay, in milliseconds.
callback - a Timed object to call when the time elapses
Returns:
a Timer object that can be used to kill the timer.
See Also:
Timers.setTimer(long, wyvern.lib.Timed)

setRepeatingTimer

public static Timer setRepeatingTimer(long period,
                                      Timed callback)
Registers a repeating timer. Note: this is almost never what you want. You usually want to use a wyvern.lib.properties.SuspendableTimer, so your timer will shut off if the map suspends or unloads.

This method will throw an IllegalArgumentException if any of the following conditions is true:

Parameters:
period - the timer interval, in milliseconds.
callback - a Timed object to call when the time elapses
Returns:
a token representing the timer
See Also:
Timers.setRepeatingTimer(wyvern.lib.Timed, long)

setRepeatingTimer

public static Timer setRepeatingTimer(long delay,
                                      long period,
                                      Timed callback)
Registers a repeating timer to start after the specified delay. Note: this is almost never what you want. You usually want to use a wyvern.lib.properties.SuspendableTimer, so your timer will shut off if the map suspends or unloads.

* This method will throw an IllegalArgumentException if any of the following conditions is true:

Parameters:
delay - how long to wait before the first timer is delivered
period - the timer interval, in milliseconds.
callback - a Timed object to call when the time elapses
Returns:
a token representing the timer
See Also:
Timers.setRepeatingTimer(wyvern.lib.Timed, long, long)

killTimer

public static void killTimer(Timer timer)
Kills a timer. If the timer isn't found in the queue, no exception is thrown; this is because the timer may have expired while this message was being processed.

Parameters:
timer - the Timer returned by setTimer.
See Also:
Timers.killTimer(wyvern.lib.Timer)