Package dev.prozilla.pine.core.state
Class Timer
java.lang.Object
dev.prozilla.pine.core.state.Timer
- All Implemented Interfaces:
Initializable
Manages time tracking, including FPS (frames per second) and UPS (updates per second) calculations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
protected static class
static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Updates FPS and UPS if a whole second has passed.double
float
int
getFPS()
float
float
int
getUPS()
void
void
void
init()
Initializes this object to prepare its usage.void
Updates the timer's delta values and elapsed time values.startInterval
(Callback callback, float delay) startInterval
(Callback callback, float delay, boolean applyTimeScale) startRandomInterval
(Callback callback, float minDelay, float maxDelay) startRandomInterval
(Callback callback, float minDelay, float maxDelay, boolean applyTimeScale) startTimeout
(Callback callback, float delay) startTimeout
(Callback callback, float delay, boolean applyTimeScale) void
stopInterval
(Timer.Interval interval) void
stopTimeout
(Timer.Timeout timeout) void
-
Field Details
-
timeScale
public float timeScaleThe 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 interfaceInitializable
-
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
-
startInterval
-
startTimeout
-
startTimeout
-
startRandomInterval
-
startRandomInterval
public Timer.RandomInterval startRandomInterval(Callback callback, float minDelay, float maxDelay, boolean applyTimeScale) -
stopInterval
-
stopTimeout
-