Package games.stendhal.client
Class GameLoop
java.lang.Object
games.stendhal.client.GameLoop
Game loop thread.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for the main game loop task. -
Method Summary
Modifier and TypeMethodDescriptionstatic GameLoopget()Get the GameLoop instance.static booleanCheck if the code is running in the game loop.voidSet the task that should be run at every loop iteration.voidAdd a task that should be run when the client quits.voidAdd a task that should be run once in the game loop thread.voidstart()Start the game loop.voidstop()Call at client quit.
-
Method Details
-
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:
trueif the called from the game loop thread,falseotherwise.
-
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
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
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
Add a task that should be run once in the game loop thread.- Parameters:
task-
-