jme.utility
Class Timer

java.lang.Object
  extended byjme.utility.Timer

public class Timer
extends java.lang.Object

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:
0.1.0
Author:
Mark Powell

Method Summary
 float getFrameRate()
          getFrameRate returns the current frame rate since the last call to update.
 float getMaxFrameRate()
          getMinFrameRate returns the highest frame rate recorded.
 float getMinFrameRate()
          getMinFrameRate returns the lowest frame rate recorded.
static Timer getTimer()
          getTimer returns the singleton instance of the Timer class.
 void setProcessPriority(int priority)
          setProcessPriority sets the priority of this application.
 void setTime(long time)
          setTime sets the time of the timer.
 java.lang.String toString()
          toString returns the string representation of this timer in the format:

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

Method Detail

getFrameRate

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

Returns:
the current frame rate.

getMinFrameRate

public float getMinFrameRate()
getMinFrameRate returns the lowest frame rate recorded.

Returns:
the lowest frame rate.

getMaxFrameRate

public float getMaxFrameRate()
getMinFrameRate returns the highest frame rate recorded.

Returns:
the highest frame rate.

setProcessPriority

public void setProcessPriority(int priority)
setProcessPriority sets the priority of this application.

Parameters:
priority - the application's priority level.

setTime

public void setTime(long time)
setTime sets the time of the timer.

Parameters:
time - the new time of the timer.

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.


getTimer

public static Timer getTimer()
getTimer returns the singleton instance of the Timer class.

Returns:
the singleton instance.

toString

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

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

Returns:
the string representation of this object.