unc.cdva.gameengine.timer
Class GameTimer

java.lang.Object
  extended by unc.cdva.events.SingleEventSource<GameEventListener>
      extended by unc.cdva.gameengine.timer.GameTimer

public class GameTimer
extends SingleEventSource<GameEventListener>

The timer for the game, notifies listeners when it fires. Thus other objects can register this object and will be notified when the timer fires. The rate of this timer is the rate at which time logically progress for the game. Thus whenever this timer is fired, objects are moved according to how far they should move in the timer interval (which is how often the timer fires).

Author:
Guillaume Conte

Field Summary
 
Fields inherited from class unc.cdva.events.SingleEventSource
listeners
 
Constructor Summary
GameTimer()
          Initializes the game timer.
 
Method Summary
protected  void notifyUpdate()
          Notifies listeners when the timer fires.
 void start()
          Starts the game timer.
 void stop()
          Stops the game timer (but it may be restarted).
 
Methods inherited from class unc.cdva.events.SingleEventSource
addListener, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameTimer

public GameTimer()
Initializes the game timer.

Method Detail

start

public void start()
Starts the game timer.


stop

public void stop()
Stops the game timer (but it may be restarted).


notifyUpdate

protected void notifyUpdate()
Notifies listeners when the timer fires.