public final class GameLoop extends UpdateLoop implements IGameLoop
IUpdatable instances.
Subsequently, it performs the rendering of the current frame and tracks some performance metrics on the process.IUpdateable.update(),
Game.loop(),
RenderComponent.render()| Modifier and Type | Field and Description |
|---|---|
static int |
TICK_DELTATIME_LAG
The tick
UpdateLoop.getDeltaTime() at which we consider the game not to run fluently anymore. |
| Modifier and Type | Method and Description |
|---|---|
void |
alterExecutionTime(int index,
long ticks)
Alters the execution time of the timed action with the specified index to the defined tick.
|
protected long |
getExpectedDelta() |
float |
getTimeScale()
Gets the game loop's current time scale (default = 1).
|
int |
perform(int delay,
java.lang.Runnable action)
Performs a timed action with the specified delay in ms.
|
protected void |
process()
In addition to the normal base implementation, the
GameLoop performs registered action at the required
time and tracks some detailed metrics. |
void |
removeAction(int id)
Removes the
TimedAction with the specified it. |
void |
setTimeScale(float timeScale)
Sets the game loop's time scale.
|
attach, close, delay, detach, getDeltaTime, getLock, getProcessTime, getTickRate, getTicks, getUpdatableCount, getUpdatables, run, setTickRate, terminate, 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, waitattach, detach, getDeltaTime, getLock, getProcessTime, getTickRate, getTicks, getUpdatableCount, setTickRatestart, terminatepublic static final int TICK_DELTATIME_LAG
UpdateLoop.getDeltaTime() at which we consider the game not to run fluently anymore.
public int perform(int delay,
java.lang.Runnable action)
IGameLoopperform in interface IGameLoopdelay - The delay in milliseconds.action - The action to perform, once the delay has passed.TimedAction that can be used to alter the execution time of the action or remove it.IGameLoop.alterExecutionTime(int, long)public float getTimeScale()
IGameLoopgetTimeScale in interface IGameLooppublic void setTimeScale(float timeScale)
IGameLoopThis can be used to fast-forward the gameplay or to introduce slow-motion effects.
setTimeScale in interface IGameLooptimeScale - The time scale to set.public void alterExecutionTime(int index,
long ticks)
IGameLoopalterExecutionTime in interface IGameLoopindex - The id of the TimedAction.ticks - The tick at which to perform the action instead.public void removeAction(int id)
IGameLoopTimedAction with the specified it.removeAction in interface IGameLoopid - The id of the TimedAction.protected void process()
GameLoop performs registered action at the required
time and tracks some detailed metrics.process in class UpdateLoopprotected long getExpectedDelta()
getExpectedDelta in class UpdateLoop