Package de.gurkenlabs.litiengine
Interface IGameLoop
- All Superinterfaces:
ILaunchable
,ILoop
- All Known Implementing Classes:
GameLoop
public interface IGameLoop
extends ILoop
The
IGameLoop
interface provides special methods for the game's main loopMethod Summary
Modifier and Type Method Description void
alterExecutionTime(int id, long tick)
Alters the execution time of the timed action with the specified index to the defined tick.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.void
removeAction(int id)
Removes theTimedAction
with the specified it.void
setTimeScale(float timeScale)
Sets the game loop's time scale.Methods inherited from interface de.gurkenlabs.litiengine.ILoop
attach, detach, getDeltaTime, getLock, getProcessTime, getTickRate, getTicks, getUpdatableCount, setTickRate
Method Details
perform
int perform(int delay, java.lang.Runnable action)Performs a timed action with the specified delay in ms.- Parameters:
delay
- The delay in milliseconds.action
- The action to perform, once the delay has passed.- Returns:
- The id of the
TimedAction
that can be used to alter the execution time of the action or remove it. - See Also:
alterExecutionTime(int, long)
alterExecutionTime
void alterExecutionTime(int id, long tick)Alters the execution time of the timed action with the specified index to the defined tick. This overwrites the originally specified delay.- Parameters:
id
- The id of theTimedAction
.tick
- The tick at which to perform the action instead.
removeAction
void removeAction(int id)Removes theTimedAction
with the specified it.- Parameters:
id
- The id of theTimedAction
.
getTimeScale
float getTimeScale()Gets the game loop's current time scale (default = 1).- Returns:
- The game loop's current time scale.
setTimeScale
void setTimeScale(float timeScale)Sets the game loop's time scale.This can be used to fast-forward the gameplay or to introduce slow-motion effects.
- Parameters:
timeScale
- The time scale to set.