public final class GameTime extends java.lang.Object implements EnvironmentLoadedListener
Modifier | Constructor and Description |
---|---|
protected |
GameTime() |
Modifier and Type | Method and Description |
---|---|
void |
loaded(Environment environment)
This method was called after the environment was loaded.
|
long |
now()
Gets the current game time in ticks.
|
long |
since(long tick)
Calculates the delta time between the current game time and the specified
ticks in milliseconds.
|
long |
sinceEnvironmentLoad()
Get the time in milliseconds that has passed since the current environment was loaded.
|
long |
sinceGameStart()
Gets the time in milliseconds that has passed since the game has been started.
This uses the configured update rate to calculate the passed time from the specified ticks. |
long |
toMilliseconds(long ticks)
Converts the specified ticks to milliseconds using the game loop's update rate.
|
long |
toMilliseconds(long ticks,
int updateRate)
Converts the specified ticks to milliseconds using the specified update rate.
|
long |
toTicks(int milliseconds)
Converts the specified milliseconds to ticks using the game loop's update rate.
|
long |
toTicks(int milliseconds,
int updateRate)
Converts the specified milliseconds to ticks using the specified update rate.
|
public long now()
UpdateLoop.getTicks()
public long since(long tick)
tick
- The tick for which to calculate the delta time.now()
public long sinceGameStart()
public long sinceEnvironmentLoad()
public long toMilliseconds(long ticks)
ticks
- The ticks that will be converted to milliseconds.public long toMilliseconds(long ticks, int updateRate)
ticks
- The ticks that will be converted to milliseconds.updateRate
- The updateRate that is used for the conversion.public long toTicks(int milliseconds)
milliseconds
- The milliseconds that will be converted to ticks.public long toTicks(int milliseconds, int updateRate)
milliseconds
- The milliseconds that will be converted to ticks.updateRate
- The updateRate that is used for the conversion.public void loaded(Environment environment)
EnvironmentLoadedListener
loaded
in interface EnvironmentLoadedListener
environment
- The environment that was loaded.