Package com.jme3.system.lwjgl
Class LwjglTimer
java.lang.Object
com.jme3.system.Timer
com.jme3.system.lwjgl.LwjglTimer
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.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
getFrameRate
returns the current frame rate since the last call toupdate
.long
Returns the resolution of the timer.long
getTime()
Returns the current time in ticks.float
Returns the time in seconds.float
Returns the time, in seconds, between the last call and the current one.void
reset()
Reset the timer to 0.toString()
toString
returns the string representation of this timer in the format:
jme.utility.Timer@1db699b
Time: {LONG}
FPS: {LONG}void
update()
update
recalculates the frame rate based on the previous call to update.
-
Field Details
-
LWJGL_TIME_TO_NANOS
public static final long LWJGL_TIME_TO_NANOS
-
-
Constructor Details
-
LwjglTimer
public LwjglTimer()Constructor builds aTimer
object. All values will be initialized to its default values.
-
-
Method Details
-
reset
public void reset()Description copied from class:Timer
Reset the timer to 0. Clear any tpf history. -
getTimeInSeconds
public float getTimeInSeconds()Description copied from class:Timer
Returns the time in seconds. The timer starts at 0.0 seconds.- Overrides:
getTimeInSeconds
in classTimer
- Returns:
- the current time in seconds
-
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 bygetResolution()
. The timer starts at 0 ticks. -
getResolution
public long getResolution()Description copied from class:Timer
Returns the resolution of the timer.- Specified by:
getResolution
in classTimer
- Returns:
- the number of timer ticks per second
- See Also:
-
getFrameRate
public float getFrameRate()getFrameRate
returns the current frame rate since the last call toupdate
.- Specified by:
getFrameRate
in classTimer
- 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 classTimer
- Returns:
- Time between this call and the last one.
-
update
public void update()update
recalculates the frame rate based on the previous call to update. It is assumed that update is called each frame. -
toString
toString
returns the string representation of this timer in the format:
jme.utility.Timer@1db699b
Time: {LONG}
FPS: {LONG}
-