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 loop
  • 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 the TimedAction.
      tick - The tick at which to perform the action instead.
    • removeAction

      void removeAction​(int id)
      Removes the TimedAction with the specified it.
      Parameters:
      id - The id of the TimedAction.
    • 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.