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

    Constructors
    Constructor
    Description
    NamedAppState(boolean initialState)
    Instantiate an uninitialized AppState with no influence.
    Instantiate an uninitialized AppState with no influence.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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.
    boolean
    hasInfluenceOver(com.jme3.app.state.AppState appState)
    Test whether this state influences the specified AppState.
    final void
    influence(com.jme3.app.state.AppState appState)
    Cause this state to influence the specified AppState.
    void
    initialize(com.jme3.app.state.AppStateManager sm, com.jme3.app.Application app)
    Initialize this state during the first update after it gets attached.
    final boolean
    Test whether this state is enabled.
    final boolean
    Test whether this state is initialized.
    void
    Callback during each frame after all rendering is complete.
    void
    render(com.jme3.renderer.RenderManager rm)
    Callback to perform rendering for this state during each frame.
    void
    setEnabled(boolean newSetting)
    Enable or disable the functionality of this state.
    void
    stateAttached(com.jme3.app.state.AppStateManager sm)
    Callback when this state gets attached.
    void
    stateDetached(com.jme3.app.state.AppStateManager sm)
    Callback when this state gets detached.
    void
    stopInfluencing(com.jme3.app.state.AppState appState)
    Remove any influence this state has over the specified AppState.
    Represent this state as a text string.
    void
    update(float tpf)
    Callback to update this state prior to rendering.

    Methods inherited from class com.jme3.app.state.AbstractAppState

    getId, setId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • NamedAppState

      public NamedAppState(boolean initialState)
      Instantiate an uninitialized AppState with no influence.
      Parameters:
      initialState - true → enabled, false → disabled
    • NamedAppState

      public NamedAppState(InitialState initialState)
      Instantiate an uninitialized AppState with no influence.
      Parameters:
      initialState - Enabled or Disabled (null means disabled)
  • Method Details

    • getInfluence

      public Collection<com.jme3.app.state.AppState> 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:
      cleanup in interface com.jme3.app.state.AppState
      Overrides:
      cleanup in class com.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:
      initialize in interface com.jme3.app.state.AppState
      Overrides:
      initialize in class com.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:
      isEnabled in interface com.jme3.app.state.AppState
      Overrides:
      isEnabled in class com.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:
      isInitialized in interface com.jme3.app.state.AppState
      Overrides:
      isInitialized in class com.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:
      postRender in interface com.jme3.app.state.AppState
      Overrides:
      postRender in class com.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:
      render in interface com.jme3.app.state.AppState
      Overrides:
      render in class com.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:
      setEnabled in interface com.jme3.app.state.AppState
      Overrides:
      setEnabled in class com.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:
      stateAttached in interface com.jme3.app.state.AppState
      Overrides:
      stateAttached in class com.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:
      stateDetached in interface com.jme3.app.state.AppState
      Overrides:
      stateDetached in class com.jme3.app.state.AbstractAppState
      Parameters:
      sm - the application's state manager (not null)
    • toString

      public String toString()
      Represent this state as a text string.
      Overrides:
      toString in class Object
      Returns:
      descriptive string of text (not null, not empty)
    • 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:
      update in interface com.jme3.app.state.AppState
      Overrides:
      update in class com.jme3.app.state.AbstractAppState
      Parameters:
      tpf - time interval between frames (in seconds, ≥0)