public abstract class GameSystem extends java.lang.Object implements java.lang.Comparable<GameSystem>
Superclass for game systems which do some work on the main loop
If you need to iterate over a group of game entities each cycle, consider
subclassing EntitySystem instead.
| Constructor and Description |
|---|
GameSystem() |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(GameSystem other) |
void |
onPause()
Override to respond when this system is paused
|
void |
onResume()
Override to respond when this system is resumed from a paused state
|
void |
onStart(GameEngine engine)
Override to respond when this system is added to an engine and initialized
|
void |
onStop(GameEngine engine)
Override to respond when this system is removed from an engine and shut
down
|
void |
onUpdate(GameEngine engine,
float deltaTime)
Called when this system should execute its main game loop behavior.
|
void |
pause()
Pause a running system
|
void |
resume()
Resume a paused system
|
public int compareTo(GameSystem other)
compareTo in interface java.lang.Comparable<GameSystem>public void resume()
Resume a paused system
public void pause()
Pause a running system
public void onStart(GameEngine engine)
Override to respond when this system is added to an engine and initialized
engine - the GameEngine the system is added topublic void onResume()
Override to respond when this system is resumed from a paused state
Systems are considered paused upon initialization, and
onResume() will always be called immediately after
onStart(GameEngine) when initializing
public void onUpdate(GameEngine engine, float deltaTime)
Called when this system should execute its main game loop behavior.
This is where the system will do most of its work, and is called once for
each time GameEngine.update(float) is called on the attached
GameEngine.
engine - The engine this update is occurring indeltaTime - The time given to GameEngine.update(float) for
this iteration of the game loop; ostensibly, the time
between the previous loop and the current onepublic void onPause()
Override to respond when this system is paused
onPause() will always be called immediately before
onStop(GameEngine) when shutting down
public void onStop(GameEngine engine)
Override to respond when this system is removed from an engine and shut down
engine - the GameEngine the system is removed from