Package dev.prozilla.pine.core.state
Class Timer
java.lang.Object
dev.prozilla.pine.core.state.Timer
- All Implemented Interfaces:
Lifecycle
Keeps track of time and time-related values like FPS and UPS.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
getDelta()
Returns the time that have passed since the last loop.int
getFPS()
Getter for the FPS.double
Getter for the last loop time.double
getTime()
Returns the time elapsed sinceglfwInit()
in seconds.int
getUPS()
Getter for the UPS.void
init()
Initializes the timer.void
update()
Updates FPS and UPS if a whole second has passed.void
Updates the FPS counter.void
Updates the UPS counter.
-
Field Details
-
timeScale
public float timeScale
-
-
Constructor Details
-
Timer
public Timer()
-
-
Method Details
-
init
public void init()Initializes the timer. -
getTime
public double getTime()Returns the time elapsed sinceglfwInit()
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. -
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
-