Class Timer

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

public class Timer extends Object implements Initializable
Manages time tracking, including FPS (frames per second) and UPS (updates per second) calculations.
  • Field Details

    • timeScale

      public float timeScale
      The scale at which time passes.
  • Constructor Details

    • Timer

      public Timer()
  • Method Details

    • init

      public void init()
      Description copied from interface: Initializable
      Initializes this object to prepare its usage.
      Specified by:
      init in interface Initializable
    • nextFrame

      public void nextFrame()
      Updates the timer's delta values and elapsed time values.
    • updateTimedActions

      public void updateTimedActions()
    • incrementFPS

      public void incrementFPS()
    • incrementUPS

      public void incrementUPS()
    • checkCounters

      public void checkCounters()
      Updates FPS and UPS if a whole second has passed.
    • getFPS

      public int getFPS()
      Returns:
      Frames per second
    • getUPS

      public int getUPS()
      Returns:
      Updates per second
    • getCurrentTime

      public double getCurrentTime()
      Returns:
      Time elapsed since GLFW was initialized in seconds.
    • getScaledElapsedTime

      public float getScaledElapsedTime()
    • getDeltaTime

      public float getDeltaTime()
    • getScaledDeltaTime

      public float getScaledDeltaTime()
    • startInterval

      public Timer.Interval startInterval(Callback callback, float delay)
    • startInterval

      public Timer.Interval startInterval(Callback callback, float delay, boolean applyTimeScale)
    • startTimeout

      public Timer.Timeout startTimeout(Callback callback, float delay)
    • startTimeout

      public Timer.Timeout startTimeout(Callback callback, float delay, boolean applyTimeScale)
    • startRandomInterval

      public Timer.RandomInterval startRandomInterval(Callback callback, float minDelay, float maxDelay)
    • startRandomInterval

      public Timer.RandomInterval startRandomInterval(Callback callback, float minDelay, float maxDelay, boolean applyTimeScale)
    • stopInterval

      public void stopInterval(Timer.Interval interval)
    • stopTimeout

      public void stopTimeout(Timer.Timeout timeout)