Class FrameTimer


  • public class FrameTimer
    extends Object
    Class that calculates the time since last second and the fps
    Author:
    Darius Dinger
    • Constructor Detail

      • FrameTimer

        public FrameTimer()
    • Method Detail

      • update

        public static void update()
        Recalculate the fps and tslf. Must be called once at every frame
      • getFps

        public static int getFps()
        Returns:
        Frames in the last second
      • getTslf

        public static float getTslf()
        Returns:
        Time (seconds) since last frame
      • setSmoothFps

        public static void setSmoothFps​(boolean smoothFps)
        If smooth fps is enabled, the fps will be calculated by the average of the last fps (fps = (fps + newFps) / 2)
        Parameters:
        smoothFps - Should be used smooth fps