Package jme3utilities
Class NamedAppState
java.lang.Object
com.jme3.app.state.AbstractAppState
jme3utilities.NamedAppState
- All Implemented Interfaces:
com.jme3.app.state.AppState
- Direct Known Subclasses:
SimpleAppState,TimeOfDay
public class NamedAppState
extends com.jme3.app.state.AbstractAppState
An AppState that can influence other AppStates.
Enabling a disabled NamedAppState enables all states it influences. Likewise, disabling an enabled NamedAppState disables any states it influences. Influence may be mutual or one-way.
- See Also:
-
AbstractAppState
-
Field Summary
Fields inherited from class com.jme3.app.state.AbstractAppState
initialized -
Constructor Summary
ConstructorsConstructorDescriptionNamedAppState(boolean initialState) Instantiate an uninitialized AppState with no influence.NamedAppState(InitialState initialState) Instantiate an uninitialized AppState with no influence. -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Clean up this state during the first update after it gets detached.Collection<com.jme3.app.state.AppState>Enumerate appstates that are influenced by this AppState.booleanhasInfluenceOver(com.jme3.app.state.AppState appState) Test whether this state influences the specified AppState.final voidinfluence(com.jme3.app.state.AppState appState) Cause this state to influence the specified AppState.voidinitialize(com.jme3.app.state.AppStateManager sm, com.jme3.app.Application app) Initialize this state during the first update after it gets attached.final booleanTest whether this state is enabled.final booleanTest whether this state is initialized.voidCallback during each frame after all rendering is complete.voidrender(com.jme3.renderer.RenderManager rm) Callback to perform rendering for this state during each frame.voidsetEnabled(boolean newSetting) Enable or disable the functionality of this state.voidstateAttached(com.jme3.app.state.AppStateManager sm) Callback when this state gets attached.voidstateDetached(com.jme3.app.state.AppStateManager sm) Callback when this state gets detached.voidstopInfluencing(com.jme3.app.state.AppState appState) Remove any influence this state has over the specified AppState.toString()Represent this state as a text string.voidupdate(float tpf) Callback to update this state prior to rendering.Methods inherited from class com.jme3.app.state.AbstractAppState
getId, setId
-
Constructor Details
-
NamedAppState
public NamedAppState(boolean initialState) Instantiate an uninitialized AppState with no influence.- Parameters:
initialState- true → enabled, false → disabled
-
NamedAppState
Instantiate an uninitialized AppState with no influence.- Parameters:
initialState- Enabled or Disabled (null means disabled)
-
-
Method Details
-
getInfluence
Enumerate appstates that are influenced by this AppState.- Returns:
- a new unmodifiable collection of pre-existing instances (not null)
-
hasInfluenceOver
public boolean hasInfluenceOver(com.jme3.app.state.AppState appState) Test whether this state influences the specified AppState.- Parameters:
appState- the AppState to test (unaffected)- Returns:
- true if influenced, false if not influenced
-
influence
public final void influence(com.jme3.app.state.AppState appState) Cause this state to influence the specified AppState.- Parameters:
appState- the AppState to influence (not null, not this, alias created)
-
stopInfluencing
public void stopInfluencing(com.jme3.app.state.AppState appState) Remove any influence this state has over the specified AppState.- Parameters:
appState- the AppState to stop influencing (unaffected)
-
cleanup
public void cleanup()Clean up this state during the first update after it gets detached. Should be invoked only by a subclass or by the AppStateManager.- Specified by:
cleanupin interfacecom.jme3.app.state.AppState- Overrides:
cleanupin classcom.jme3.app.state.AbstractAppState
-
initialize
public void initialize(com.jme3.app.state.AppStateManager sm, com.jme3.app.Application app) Initialize this state during the first update after it gets attached. Should be invoked only by a subclass or by the AppStateManager.- Specified by:
initializein interfacecom.jme3.app.state.AppState- Overrides:
initializein classcom.jme3.app.state.AbstractAppState- Parameters:
sm- the application's state manager (not null)app- the application which owns this state (not null)
-
isEnabled
public final boolean isEnabled()Test whether this state is enabled. Declared final here to prevent subclasses from overriding it.- Specified by:
isEnabledin interfacecom.jme3.app.state.AppState- Overrides:
isEnabledin classcom.jme3.app.state.AbstractAppState- Returns:
- true if enabled, otherwise false
-
isInitialized
public final boolean isInitialized()Test whether this state is initialized. Declared final here to prevent subclasses from overriding it.- Specified by:
isInitializedin interfacecom.jme3.app.state.AppState- Overrides:
isInitializedin classcom.jme3.app.state.AbstractAppState- Returns:
- true if initialized, otherwise false
-
postRender
public void postRender()Callback during each frame after all rendering is complete.- Specified by:
postRenderin interfacecom.jme3.app.state.AppState- Overrides:
postRenderin classcom.jme3.app.state.AbstractAppState
-
render
public void render(com.jme3.renderer.RenderManager rm) Callback to perform rendering for this state during each frame.- Specified by:
renderin interfacecom.jme3.app.state.AppState- Overrides:
renderin classcom.jme3.app.state.AbstractAppState- Parameters:
rm- the application's render manager (not null)
-
setEnabled
public void setEnabled(boolean newSetting) Enable or disable the functionality of this state.- Specified by:
setEnabledin interfacecom.jme3.app.state.AppState- Overrides:
setEnabledin classcom.jme3.app.state.AbstractAppState- Parameters:
newSetting- true → enable, false → disable
-
stateAttached
public void stateAttached(com.jme3.app.state.AppStateManager sm) Callback when this state gets attached. Executes on the same thread as stateManager.attach(). Used mostly for debugging.- Specified by:
stateAttachedin interfacecom.jme3.app.state.AppState- Overrides:
stateAttachedin classcom.jme3.app.state.AbstractAppState- Parameters:
sm- the application's state manager (not null)
-
stateDetached
public void stateDetached(com.jme3.app.state.AppStateManager sm) Callback when this state gets detached. Executes on the same thread as stateManager.detach(). Used mostly for debugging.- Specified by:
stateDetachedin interfacecom.jme3.app.state.AppState- Overrides:
stateDetachedin classcom.jme3.app.state.AbstractAppState- Parameters:
sm- the application's state manager (not null)
-
toString
Represent this state as a text string. -
update
public void update(float tpf) Callback to update this state prior to rendering. (Invoked once per frame while the state is attached and enabled.)- Specified by:
updatein interfacecom.jme3.app.state.AppState- Overrides:
updatein classcom.jme3.app.state.AbstractAppState- Parameters:
tpf- time interval between frames (in seconds, ≥0)
-