Class LwjglSmoothingTimer

java.lang.Object
com.jme3.system.Timer
com.jme3.system.lwjgl.LwjglSmoothingTimer

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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
    static int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor builds a Timer object.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    getFrameRate returns the current frame rate since the last call to update.
    long
    Returns the resolution of the timer.
    long
    Returns the current time in ticks.
    float
    Returns the time, in seconds, between the last call and the current one.
    void
    Reset the timer to 0.
    toString returns the string representation of this timer in the format:

    jme.utility.Timer@1db699b
    Time: {LONG}
    FPS: {LONG}
    void
    update recalculates the frame rate based on the previous call to update.

    Methods inherited from class com.jme3.system.Timer

    getTimeInSeconds

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • TIMER_SMOOTHNESS

      public static int TIMER_SMOOTHNESS
    • LWJGL_TIME_TO_NANOS

      public static final long LWJGL_TIME_TO_NANOS
  • Constructor Details

    • LwjglSmoothingTimer

      public LwjglSmoothingTimer()
      Constructor builds a Timer 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.
      Specified by:
      reset in class Timer
    • 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 by getResolution(). The timer starts at 0 ticks.
      Specified by:
      getTime in class Timer
      Returns:
      a long value representing the current time
      See Also:
    • getResolution

      public long getResolution()
      Description copied from class: Timer
      Returns the resolution of the timer.
      Specified by:
      getResolution in class Timer
      Returns:
      the number of timer ticks per second
      See Also:
    • getFrameRate

      public float getFrameRate()
      getFrameRate returns the current frame rate since the last call to update.
      Specified by:
      getFrameRate in class Timer
      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 class Timer
      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.
      Specified by:
      update in class Timer
    • toString

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

      jme.utility.Timer@1db699b
      Time: {LONG}
      FPS: {LONG}
      Overrides:
      toString in class Object
      Returns:
      the string representation of this object.