Package com.jme3.app.state
Class AbstractAppState
java.lang.Object
com.jme3.app.state.AbstractAppState
- All Implemented Interfaces:
AppState
- Direct Known Subclasses:
AWTComponentAppState,BulletAppState,BulletDebugAppState,ChaseCameraAppState,DebugKeysAppState,FlyCamAppState,MaterialDebugAppState,ResetStatsState,RootNodeAppState,ScreenshotAppState,StatsAppState,VideoRecorderAppState,VRAppState
AbstractAppState implements some common methods
that make creation of AppStates easier.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleaninitializedis set to true when the methodinitialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)is called. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Called byAppStateManagerwhen transitioning thisAppStatefrom terminating to detached.getId()Returns the unique ID for this AppState or null if it has no unique ID.voidinitialize(AppStateManager stateManager, Application app) Called byAppStateManagerwhen transitioning thisAppStatefrom initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)was called.booleanbooleanvoidCalled after all rendering commands are flushed.voidrender(RenderManager rm) Render the state.voidsetEnabled(boolean enabled) Enable or disable the functionality of theAppState.protected voidSets the unique ID of this app state.voidstateAttached(AppStateManager stateManager) Called byAppStateManager.attach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom detached to initializing.voidstateDetached(AppStateManager stateManager) Called byAppStateManager.detach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom running to terminating.voidupdate(float tpf) Called to update theAppState.
-
Field Details
-
initialized
protected boolean initializedinitializedis set to true when the methodinitialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)is called. Whencleanup()is called,initializedis set back to false.
-
-
Constructor Details
-
AbstractAppState
protected AbstractAppState() -
AbstractAppState
-
-
Method Details
-
initialize
Description copied from interface:AppStateCalled byAppStateManagerwhen transitioning thisAppStatefrom initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)was called.AppStateManagerwill call this only from the update loop inside the rendering thread. This means is it safe to modify the scene graph from this method.- Specified by:
initializein interfaceAppState- Parameters:
stateManager- The state managerapp- The application
-
isInitialized
public boolean isInitialized()- Specified by:
isInitializedin interfaceAppState- Returns:
- True if
initialize()was called on the state, false otherwise.
-
setId
Sets the unique ID of this app state. Note: that setting this while an app state is attached to the state manager will have no effect on ID-based lookups.- Parameters:
id- the desired ID
-
getId
Description copied from interface:AppStateReturns the unique ID for this AppState or null if it has no unique ID. -
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:AppStateEnable or disable the functionality of theAppState. The effect of this call depends on implementation. AnAppStatestarts as being enabled by default. A disabledAppStates does not get calls toAppState.update(float),AppState.render(RenderManager), orAppState.postRender()from itsAppStateManager.- Specified by:
setEnabledin interfaceAppState- Parameters:
enabled- activate the AppState or not.
-
isEnabled
public boolean isEnabled() -
stateAttached
Description copied from interface:AppStateCalled byAppStateManager.attach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom detached to initializing.There is no assumption about the thread from which this function is called, therefore it is unsafe to modify the scene graph from this method. Please use
AppState.initialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)instead.- Specified by:
stateAttachedin interfaceAppState- Parameters:
stateManager- State manager to which the state was attached to.
-
stateDetached
Description copied from interface:AppStateCalled byAppStateManager.detach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom running to terminating.There is no assumption about the thread from which this function is called, therefore it is unsafe to modify the scene graph from this method. Please use
AppState.cleanup()instead.- Specified by:
stateDetachedin interfaceAppState- Parameters:
stateManager- The state manager from which the state was detached from.
-
update
public void update(float tpf) Description copied from interface:AppStateCalled to update theAppState. This method will be called every render pass if theAppStateis both attached and enabled. -
render
Description copied from interface:AppStateRender the state. This method will be called every render pass if theAppStateis both attached and enabled. -
postRender
public void postRender()Description copied from interface:AppStateCalled after all rendering commands are flushed. This method will be called every render pass if theAppStateis both attached and enabled.- Specified by:
postRenderin interfaceAppState
-
cleanup
public void cleanup()Description copied from interface:AppStateCalled byAppStateManagerwhen transitioning thisAppStatefrom terminating to detached. This method is called the following render pass after theAppStatehas been detached and is always called once and only once for each timeinitialize()is called. Either when theAppStateis detached or when the application terminates (if it terminates normally).
-