Package model.utilz

Class PlayingTimer

java.lang.Object
model.utilz.PlayingTimer

public class PlayingTimer extends Object
Singleton class that manages the playing timer, used to heep track of the time delta between updates.
  • Method Details

    • getInstance

      public static PlayingTimer getInstance()
      Returns the singleton instance of the PlayingTimer.
      Returns:
      the singleton instance
    • update

      public void update()
      Updates the timer. Calculates the time delta since the last update. If this is the first update, initializes the last timer update time.
    • reset

      public void reset()
      Resets the timer by setting the last timer update time to the current system time.
    • newPlayReset

      public void newPlayReset()
      Resets the timer for a new play session. Sets the first update flag to true and resets the time delta.
    • getTimeDelta

      public long getTimeDelta()
      Returns the time delta between the last two updates.
      Returns:
      the time delta in milliseconds