Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.lwjgl.util
Class Timer

    java.lang.Object
      org.lwjgl.util.Timer

    public class Timer

extends java.lang.Object

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: 2286 $ $Id: Timer.java 2286 2006-03-23 19:32:21Z matzon $
Author:
  cix_foo

Constructor Summary
`Timer()` Constructs a timer.

Method Summary
`float` | `getTime()`
`boolean` | `isPaused()`
`void` | `pause()` Pause the timer.
`void` | `reset()` Reset the timer.
`void` | `resume()` Resume the timer.
`void` | `set(float newTime)` Set the time of this timer
`static void` | `tick()` Get the next time update from the system's hires timer.
`java.lang.String` | `toString()` Debug output.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Timer

    public Timer()

  Constructs a timer. The timer will be reset to 0.0 and resumed immediately.

Method Detail

### 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:
    `resume()`

### reset

    public void reset()

  Reset the timer. Equivalent to set(0.0f);

  See Also:
    `set(float)`

### resume

    public void resume()

  Resume the timer.

  See Also:
    `pause()`

### 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

    public java.lang.String toString()

  Debug output.

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2006 lwjgl.org. All Rights Reserved.