public class LwjglSmoothingTimer 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.| Modifier and Type | Field and Description |
|---|---|
static long |
LWJGL_TIME_TO_NANOS |
static int |
TIMER_SMOOTHNESS |
| Constructor and Description |
|---|
LwjglSmoothingTimer()
Constructor builds a
Timer object. |
| Modifier and Type | Method and Description |
|---|---|
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 recalculates the frame rate based on the previous
call to update. |
getTimeInSecondspublic static int TIMER_SMOOTHNESS
public static final long LWJGL_TIME_TO_NANOS
public LwjglSmoothingTimer()
Timer object. All values will be
initialized to its default values.public void reset()
Timerpublic long getTime()
TimergetResolution(). The timer starts at 0 ticks.getTime in class TimerTimer.getTime()public long getResolution()
TimergetResolution in class TimerTimer.getResolution()public float getFrameRate()
getFrameRate returns the current frame rate since the last
call to update.getFrameRate in class Timerpublic float getTimePerFrame()
TimergetTimePerFrame in class Timerpublic void update()
update recalculates the frame rate based on the previous
call to update. It is assumed that update is called each frame.public java.lang.String toString()
toString returns the string representation of this timer
in the format: toString in class java.lang.Object