feud.testgame.util
Class Ticker

java.lang.Object
  extended byfeud.testgame.util.Ticker

public class Ticker
extends java.lang.Object

A simple ticker class for measuring in-game-time. This was formerly based on the LWJGL Timer class, but that class has some unfixed problems on some machines/VMs...so it's based on Java5's nanotime now.


Constructor Summary
Ticker(int tickrateMS)
          Create a new ticker that ticks every n-th millisecond.
 
Method Summary
 void forward()
          Forward the ticker to the next tick.
 int getTicks()
          How many ticks have passed since the last call?
 void reset()
          Reset the ticker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ticker

public Ticker(int tickrateMS)
Create a new ticker that ticks every n-th millisecond.

Parameters:
tickrateMS - the interval
Method Detail

reset

public void reset()
Reset the ticker.


forward

public void forward()
Forward the ticker to the next tick.


getTicks

public int getTicks()
How many ticks have passed since the last call?

Returns:
int number of ticks