Package games.stendhal.client
Class GameLoop
java.lang.Object
games.stendhal.client.GameLoop
Game loop thread.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface for the main game loop task. -
Method Summary
Modifier and TypeMethodDescriptionstatic GameLoop
get()
Get the GameLoop instance.static boolean
Check if the code is running in the game loop.void
Set the task that should be run at every loop iteration.void
Add a task that should be run when the client quits.void
Add a task that should be run once in the game loop thread.void
start()
Start the game loop.void
stop()
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:
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
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
-
-