com.jme3.app.state
Class AppStateManager

java.lang.Object
  extended by com.jme3.app.state.AppStateManager

public class AppStateManager
extends java.lang.Object

The AppStateManager holds a list of AppStates which it will update and render.
When an AppState is attached or detached, the AppState.stateAttached(com.jme3.app.state.AppStateManager) and AppState.stateDetached(com.jme3.app.state.AppStateManager) methods will be called respectively.

The lifecycle for an attached AppState is as follows:


Constructor Summary
AppStateManager(Application app)
           
 
Method Summary
 boolean attach(AppState state)
          Attach a state to the AppStateManager, the same state cannot be attached twice.
 void cleanup()
          Calls cleanup on attached states, do not call directly.
 boolean detach(AppState state)
          Detaches the state from the AppStateManager.
protected  AppState[] getInitializing()
           
<T extends AppState>
T
getState(java.lang.Class<T> stateClass)
          Returns the first state that is an instance of subclass of the specified class.
protected  AppState[] getStates()
           
protected  AppState[] getTerminating()
           
 boolean hasState(AppState state)
          Check if a state is attached or not.
protected  void initializePending()
           
 void postRender()
          Calls render for all attached and initialized states, do not call directly.
 void render(RenderManager rm)
          Calls render for all attached and initialized states, do not call directly.
protected  void terminatePending()
           
 void update(float tpf)
          Calls update for attached states, do not call directly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppStateManager

public AppStateManager(Application app)
Method Detail

getInitializing

protected AppState[] getInitializing()

getTerminating

protected AppState[] getTerminating()

getStates

protected AppState[] getStates()

attach

public boolean attach(AppState state)
Attach a state to the AppStateManager, the same state cannot be attached twice.

Parameters:
state - The state to attach
Returns:
True if the state was successfully attached, false if the state was already attached.

detach

public boolean detach(AppState state)
Detaches the state from the AppStateManager.

Parameters:
state - The state to detach
Returns:
True if the state was detached successfully, false if the state was not attached in the first place.

hasState

public boolean hasState(AppState state)
Check if a state is attached or not.

Parameters:
state - The state to check
Returns:
True if the state is currently attached to this AppStateManager.
See Also:
attach(com.jme3.app.state.AppState)

getState

public <T extends AppState> T getState(java.lang.Class<T> stateClass)
Returns the first state that is an instance of subclass of the specified class.

Type Parameters:
T -
Parameters:
stateClass -
Returns:
First attached state that is an instance of stateClass

initializePending

protected void initializePending()

terminatePending

protected void terminatePending()

update

public void update(float tpf)
Calls update for attached states, do not call directly.

Parameters:
tpf - Time per frame.

render

public void render(RenderManager rm)
Calls render for all attached and initialized states, do not call directly.

Parameters:
rm - The RenderManager

postRender

public void postRender()
Calls render for all attached and initialized states, do not call directly.


cleanup

public void cleanup()
Calls cleanup on attached states, do not call directly.