public class GameLoop extends UpdateLoop implements IGameLoop, java.lang.AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static int |
TICK_DELTATIME_LAG
The tick
getDeltaTime() at which we consider the game not to run fluently anymore. |
| Constructor and Description |
|---|
GameLoop(java.lang.String name,
int updateRate) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
convertToMs(long ticks) |
long |
convertToTicks(int ms) |
int |
execute(int delay,
java.lang.Runnable action) |
long |
getDeltaTime()
Gets the time that passed since the last tick in ms.
|
long |
getDeltaTime(long ticks)
Calculates the deltatime between the current game time and the specified
ticks in ms.
|
long |
getTicks() |
float |
getTimeScale() |
int |
getUpdateRate() |
void |
run() |
void |
setTimeScale(float timeScale) |
void |
terminate() |
void |
updateExecutionTime(int index,
long ticks) |
attach, detach, getUpdatables, updateactiveCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitstartpublic static final int TICK_DELTATIME_LAG
getDeltaTime() at which we consider the game not to run fluently anymore.
public void close()
close in interface java.lang.AutoCloseablepublic long convertToMs(long ticks)
convertToMs in interface IGameLooppublic long convertToTicks(int ms)
convertToTicks in interface IGameLooppublic int execute(int delay,
java.lang.Runnable action)
public long getDeltaTime()
IGameLoopgetDeltaTime in interface IGameLooppublic long getDeltaTime(long ticks)
IGameLoopgetDeltaTime in interface IGameLoopticks - The ticks for which to calculate the delta time.public float getTimeScale()
getTimeScale in interface IGameLooppublic int getUpdateRate()
getUpdateRate in interface IGameLooppublic void run()
run in interface java.lang.Runnablerun in class UpdateLooppublic void setTimeScale(float timeScale)
setTimeScale in interface IGameLooppublic void terminate()
terminate in interface ILaunchablepublic void updateExecutionTime(int index,
long ticks)
updateExecutionTime in interface IGameLoop