Class GameLoop

java.lang.Object
games.stendhal.client.GameLoop

public class GameLoop extends Object
Game loop thread.
  • Method Details

    • get

      public static GameLoop get()
      Get the GameLoop instance.
      Returns:
      game loop instance
    • isGameLoop

      public static boolean isGameLoop()
      Check if the code is running in the game loop.
      Returns:
      true if the called from the game loop thread, false otherwise.
    • start

      public void start()
      Start the game loop.
    • stop

      public void stop()
      Call at client quit. Tells the game loop to continue to the cleanup tasks.
    • runAllways

      public void runAllways(GameLoop.PersistentTask task)
      Set the task that should be run at every loop iteration. This must not be called after the GameLoop has been started.
      Parameters:
      task -
    • runAtQuit

      public void runAtQuit(Runnable task)
      Add a task that should be run when the client quits. This must not be called after the GameLoop has been started.
      Parameters:
      task -
    • runOnce

      public void runOnce(Runnable task)
      Add a task that should be run once in the game loop thread.
      Parameters:
      task -