espresso3d.engine.timer
Class E3DTimer

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.timer.E3DTimer
Direct Known Subclasses:
E3DFPSTimer

public class E3DTimer
extends E3DEngineItem

Author:
Curt A basic timer template that can be extended or used.

Constructor Summary
E3DTimer(E3DEngine engine)
           
 
Method Summary
 double getCurrentEngineTimeSeconds()
          Returns the current engine time in seconds
 long getCurrentTickCount()
          Gets the current tick time.
 long getLastTickCount()
          Gets the start tick time that is stored for the last frame
 double getLastUpdateTimeSeconds()
          Get how long it was between the last update and this update.
 long getTickResolution()
          Returns what the tick count needs to be for 1 second.
 void resetTimer()
           
 void update()
          Updates the last frame time and sets the lastTickCount to be the current
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DTimer

public E3DTimer(E3DEngine engine)
Method Detail

update

public void update()
Updates the last frame time and sets the lastTickCount to be the current


getLastTickCount

public long getLastTickCount()
Gets the start tick time that is stored for the last frame

Returns:
Returns the lastTickCount.

getCurrentTickCount

public long getCurrentTickCount()
Gets the current tick time.

Returns:

getTickResolution

public long getTickResolution()
Returns what the tick count needs to be for 1 second. Can be useful to see how long a frame actually took to render. Dividing lastFrameTime by tickResolution gets lastFrameTime in seconds (the same as getLastFrameTimeSeconds).

Returns:

getLastUpdateTimeSeconds

public double getLastUpdateTimeSeconds()
Get how long it was between the last update and this update. Useful in FPS and making speeds of items be time based (multiply speed by this amt)

Returns:

resetTimer

public void resetTimer()

getCurrentEngineTimeSeconds

public double getCurrentEngineTimeSeconds()
Returns the current engine time in seconds