Package org.lwjgl.util
Class Timer
java.lang.Object
org.lwjgl.util.Timer
A hires timer. This measures time in seconds as floating point values.
All Timers created are updated simultaneously by calling the static method
tick(). This ensures that within a single iteration of a game loop that
all timers are updated consistently with each other.
- Version:
- $Revision$ $Id$
- Author:
- cix_foo invalid input: '<'cix_foo@users.sourceforge.net>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatgetTime()booleanisPaused()voidpause()Pause the timer.voidreset()Reset the timer.voidresume()Resume the timer.voidset(float newTime) Set the time of this timerstatic voidtick()Get the next time update from the system's hires timer.toString()Debug output.
-
Constructor Details
-
Timer
public Timer()Constructs a timer. The timer will be reset to 0.0 and resumed immediately.
-
-
Method Details
-
getTime
public float getTime()- Returns:
- the time in seconds, as a float
-
isPaused
public boolean isPaused()- Returns:
- whether this timer is paused
-
pause
public void pause()Pause the timer. Whilst paused the time will not change for this timer when tick() is called.- See Also:
-
reset
public void reset()Reset the timer. Equivalent to set(0.0f);- See Also:
-
resume
public void resume()Resume the timer.- See Also:
-
set
public void set(float newTime) Set the time of this timer- Parameters:
newTime- the new time, in seconds
-
tick
public static void tick()Get the next time update from the system's hires timer. This method should be called once per main loop iteration; all timers are updated simultaneously from it. -
toString
Debug output.
-