Class Timer

java.lang.Object
dev.prozilla.pine.core.state.Timer
All Implemented Interfaces:
Lifecycle

public class Timer extends Object implements Lifecycle
Keeps track of time and time-related values like FPS and UPS.
  • Field Details

    • timeScale

      public float timeScale
  • Constructor Details

    • Timer

      public Timer()
  • Method Details

    • init

      public void init()
      Initializes the timer.
      Specified by:
      init in interface Lifecycle
    • getTime

      public double getTime()
      Returns the time elapsed since glfwInit() in seconds.
      Returns:
      System time in seconds
    • getDelta

      public float getDelta()
      Returns the time that have passed since the last loop.
      Returns:
      Delta time in seconds
    • updateFPS

      public void updateFPS()
      Updates the FPS counter.
    • updateUPS

      public void updateUPS()
      Updates the UPS counter.
    • update

      public void update()
      Updates FPS and UPS if a whole second has passed.
      Specified by:
      update in interface Lifecycle
    • getFPS

      public int getFPS()
      Getter for the FPS.
      Returns:
      Frames per second
    • getUPS

      public int getUPS()
      Getter for the UPS.
      Returns:
      Updates per second
    • getLastLoopTime

      public double getLastLoopTime()
      Getter for the last loop time.
      Returns:
      System time of the last loop