com.jme.util.lwjgl
Class LWJGLTimer

java.lang.Object
  extended by com.jme.util.Timer
      extended by com.jme.util.lwjgl.LWJGLTimer

public class LWJGLTimer
extends Timer

Timer handles the system's time related functionality. This allows the calculation of the framerate. To keep the framerate calculation accurate, a call to update each frame is required. Timer is a singleton object and must be created via the getTimer method.

Version:
$Id: LWJGLTimer.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Mark Powell

Field Summary
static int TIMER_SMOOTHNESS
           
 
Fields inherited from class com.jme.util.Timer
instance
 
Constructor Summary
LWJGLTimer()
          Constructor builds a Timer object.
 
Method Summary
 float getFrameRate()
          getFrameRate returns the current frame rate since the last call to update.
 long getResolution()
          Returns the resolution of the timer.
 long getTime()
          Returns the current time in ticks.
 float getTimePerFrame()
          Returns the time, in seconds, between the last call and the current one.
 void reset()
          Reset the timer to 0.
 java.lang.String toString()
          toString returns the string representation of this timer in the format:

jme.utility.Timer@1db699b
Time: {LONG}
FPS: {LONG}
 void update()
          update recalulates the frame rate based on the previous call to update.
 
Methods inherited from class com.jme.util.Timer
getTimeInSeconds, getTimer, setTimer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TIMER_SMOOTHNESS

public static int TIMER_SMOOTHNESS
Constructor Detail

LWJGLTimer

public LWJGLTimer()
Constructor builds a Timer object. All values will be initialized to it's default values.

Method Detail

reset

public void reset()
Description copied from class: Timer
Reset the timer to 0. Clear any tpf history.

Specified by:
reset in class Timer

getTime

public long getTime()
Description copied from class: Timer
Returns the current time in ticks. A tick is an arbitrary measure of time defined by the timer implementation. The number of ticks per second is given by getResolution(). The timer starts at 0 ticks.

Specified by:
getTime in class Timer
Returns:
a long value representing the current time
See Also:
Timer.getTime()

getResolution

public long getResolution()
Description copied from class: Timer
Returns the resolution of the timer.

Specified by:
getResolution in class Timer
Returns:
the number of timer ticks per second
See Also:
Timer.getResolution()

getFrameRate

public float getFrameRate()
getFrameRate returns the current frame rate since the last call to update.

Specified by:
getFrameRate in class Timer
Returns:
the current frame rate.

getTimePerFrame

public float getTimePerFrame()
Description copied from class: Timer
Returns the time, in seconds, between the last call and the current one.

Specified by:
getTimePerFrame in class Timer
Returns:
Time between this call and the last one.

update

public void update()
update recalulates the frame rate based on the previous call to update. It is assumed that update is called each frame.

Specified by:
update in class Timer

toString

public java.lang.String toString()
toString returns the string representation of this timer in the format:

jme.utility.Timer@1db699b
Time: {LONG}
FPS: {LONG}

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this object.